Fix ID selector when getting shocker ids
This commit is contained in:
parent
ae5429ba65
commit
09ce5cbedc
@ -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.2.4</Version>
|
<Version>1.2.5</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -28,8 +28,7 @@ public class OpenShockHttp : HttpShocker
|
|||||||
this.Logger?.Log(LogLevel.Debug, $"{requestDevices.RequestUri} response: {responseDevices.StatusCode}\n{deviceJson}");
|
this.Logger?.Log(LogLevel.Debug, $"{requestDevices.RequestUri} response: {responseDevices.StatusCode}\n{deviceJson}");
|
||||||
JObject deviceListJObj = JObject.Parse(deviceJson);
|
JObject deviceListJObj = JObject.Parse(deviceJson);
|
||||||
List<string> deviceIds = new();
|
List<string> deviceIds = new();
|
||||||
foreach(JToken device in deviceListJObj.SelectTokens("data"))
|
deviceIds.AddRange(deviceListJObj["data"]!.Children()["id"].Values<string>()!);
|
||||||
deviceIds.Add(device.SelectToken("id")!.Value<string>()!);
|
|
||||||
|
|
||||||
List<string> shockerIds = new();
|
List<string> shockerIds = new();
|
||||||
foreach (string deviceId in deviceIds)
|
foreach (string deviceId in deviceIds)
|
||||||
@ -49,8 +48,7 @@ public class OpenShockHttp : HttpShocker
|
|||||||
string shockerJson = shockerStreamReader.ReadToEnd();
|
string shockerJson = shockerStreamReader.ReadToEnd();
|
||||||
this.Logger?.Log(LogLevel.Debug, $"{requestShockers.RequestUri} response: {response.StatusCode}\n{shockerJson}");
|
this.Logger?.Log(LogLevel.Debug, $"{requestShockers.RequestUri} response: {response.StatusCode}\n{shockerJson}");
|
||||||
JObject shockerListJObj = JObject.Parse(shockerJson);
|
JObject shockerListJObj = JObject.Parse(shockerJson);
|
||||||
foreach(JToken shocker in shockerListJObj.SelectTokens("data"))
|
shockerIds.AddRange(shockerListJObj["data"]!.Children()["id"].Values<string>()!);
|
||||||
shockerIds.Add(shocker.SelectToken("id")!.Value<string>()!);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return shockerIds;
|
return shockerIds;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user