Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/narazaka/shiorisharp
https://github.com/narazaka/shiorisharp
ghost shiori shiori-protocol-parser ukagaka
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/narazaka/shiorisharp
- Owner: Narazaka
- License: zlib
- Created: 2020-12-26T19:07:20.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-30T08:49:37.000Z (about 4 years ago)
- Last Synced: 2024-11-26T13:14:38.755Z (about 1 month ago)
- Topics: ghost, shiori, shiori-protocol-parser, ukagaka
- Language: C#
- Homepage:
- Size: 105 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ShioriSharp
![build](https://github.com/Narazaka/ShioriSharp/workflows/build/badge.svg)
![Nuget](https://img.shields.io/nuget/v/ShioriSharp)SHIORI/2.x,3.x SAORI/1.0 Protocol Parser / Container
## Install
available on [NuGet](https://www.nuget.org/packages/ShioriSharp/)
## Usage
```csharp
using Xunit;
using ShioriSharp.Message;
using ShioriSharp.Parser;namespace Demo {
public class Demo {
const string CRLF = "\xd\xa";[Fact]
public void ParseSHIORI() {
var requestStr = $"GET SHIORI/3.0{CRLF}Sender: さくら{CRLF}{CRLF}";
var request = Parser.ParseRequest(requestStr);
Assert.True(request.Valid);
Assert.True(request.Method == "GET");
Assert.True(request.Method == Method.Enum.GET);
Assert.True(request.Version == 3.0);
Assert.True(request.Headers.Sender == "さくら");
Assert.Equal(requestStr, request.ToString());
}[Fact]
public void BuildSHIORI() {
var response = new Response(200) { Headers = { Sender = "まゆら", Value = @"\hあー。\e" } };
Assert.Equal(response.ToString(), $"SHIORI/3.0 200 OK{CRLF}Sender: まゆら{CRLF}Value: \\hあー。\\e{CRLF}{CRLF}");
Assert.Equal("SHIORI/3.0 200 OK", Parser.ParseResponse(response.ToString()).StatusLine.ToString());
}[Fact]
public void BuildSAORI() {
var request = new Request("EXECUTE", "SAORI") { Headers = { { "Argument0", "Foo" } } };
Assert.Equal("Foo", request.Headers.Get("Argument0"));
}
}
}
```## License
[Zlib License](LICENSE)