Compare commits

..

2 Commits

Author SHA1 Message Date
a6e2bef231 Update OpenShockHttp to version 2 api 2024-01-19 01:21:39 +01:00
174cea5724 nuget version 2024-01-19 01:21:02 +01:00
2 changed files with 13 additions and 9 deletions

View File

@ -7,7 +7,7 @@
<Authors>Glax</Authors> <Authors>Glax</Authors>
<RepositoryUrl>https://github.com/C9Glax/CShocker</RepositoryUrl> <RepositoryUrl>https://github.com/C9Glax/CShocker</RepositoryUrl>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<Version>1.1.10</Version> <Version>1.1.11</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -15,18 +15,22 @@ public class OpenShockHttp : HttpShocker
{ {
Headers = Headers =
{ {
UserAgent = { new ProductInfoHeaderValue("OpenCS2hock", "1") }, UserAgent = { new ProductInfoHeaderValue("CShocker", "1") },
Accept = { new MediaTypeWithQualityHeaderValue("application/json") } Accept = { new MediaTypeWithQualityHeaderValue("application/json") }
}, },
Content = new StringContent(@"[ { "+ Content = new StringContent("{ shocks: ["+
$"\"id\": \"{shockerId}\"," + "{ "+
$"\"type\": {ControlActionToByte(action)},"+ $"\"id\": \"{shockerId}\"," +
$"\"intensity\": {intensity},"+ $"\"type\": {ControlActionToByte(action)},"+
$"\"duration\": {duration}"+ $"\"intensity\": {intensity},"+
"}]", Encoding.UTF8, new MediaTypeHeaderValue("application/json")) $"\"duration\": {duration}"+
"}" +
"]," +
"customName: CShocker" +
"}", Encoding.UTF8, new MediaTypeHeaderValue("application/json"))
}; };
request.Headers.Add("OpenShockToken", ApiKey); request.Headers.Add("OpenShockToken", ApiKey);
HttpResponseMessage response = (HttpClient.Send(request)); HttpResponseMessage response = HttpClient.Send(request);
this.Logger?.Log(LogLevel.Debug, $"{request.RequestUri} response: {response.StatusCode}"); this.Logger?.Log(LogLevel.Debug, $"{request.RequestUri} response: {response.StatusCode}");
} }