JsonConverter fix OpenShockHttp, add PiShockHttp

This commit is contained in:
glax 2024-01-19 01:58:36 +01:00
parent eb82034190
commit aefe3ab30b
2 changed files with 12 additions and 3 deletions

View File

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

View File

@ -25,11 +25,20 @@ public class ShockerJsonConverter : JsonConverter
jo.SelectToken("ShockerIds")!.ToObject<List<string>>()!,
jo.SelectToken("IntensityRange")!.ToObject<IntensityRange>()!,
jo.SelectToken("DurationRange")!.ToObject<DurationRange>()!,
jo.SelectToken("Endpoint")!.Value<string>()!,
jo.SelectToken("ApiKey")!.Value<string>()!
jo.SelectToken("ApiKey")!.Value<string>()!,
jo.SelectToken("Endpoint")!.Value<string>()!
);
case ShockerApi.OpenShockSerial:
case ShockerApi.PiShockHttp:
return new PiShockHttp(
jo.SelectToken("ShockerIds")!.ToObject<List<string>>()!,
jo.SelectToken("IntensityRange")!.ToObject<IntensityRange>()!,
jo.SelectToken("DurationRange")!.ToObject<DurationRange>()!,
jo.SelectToken("ApiKey")!.Value<string>()!,
jo.SelectToken("Username")!.Value<string>()!,
jo.SelectToken("ShareCode")!.Value<string>()!,
jo.SelectToken("Endpoint")!.Value<string>()!
);
case ShockerApi.PiShockSerial:
throw new NotImplementedException();
default: