Fix unecessary parameters in OpenShockApi.GetShockers();

This commit is contained in:
glax 2024-02-04 16:25:15 +01:00
parent f939e79e69
commit c603fe0ccb
3 changed files with 4 additions and 5 deletions

View File

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

View File

@ -35,10 +35,9 @@ public abstract class OpenShockApi : Api
return HashCode.Combine(Endpoint, ApiKey);
}
public List<OpenShockShocker> GetShockers(string apiKey, string apiEndpoint = DefaultEndpoint,
ILogger? logger = null)
public List<OpenShockShocker> GetShockers()
{
return GetShockers(apiKey, this, apiEndpoint, logger);
return GetShockers(this.ApiKey, this, this.Endpoint, this.Logger);
}
public static List<OpenShockShocker> GetShockers(string apiKey, OpenShockApi api, string apiEndpoint = DefaultEndpoint, ILogger? logger = null)

View File

@ -47,7 +47,7 @@ while (!int.TryParse(selectedPortStr, out selectedPort) || selectedPort < 0 || s
}
OpenShockSerial openShockSerial = new(new IntensityRange(30, 50), new DurationRange(1000, 1000),serialPorts[selectedPort], apiKey, logger: logger);
OpenShockShocker shocker = openShockSerial.GetShockers(apiKey).First();
OpenShockShocker shocker = openShockSerial.GetShockers().First();
shocker.Control(ControlAction.Vibrate, 20, 1000);
File.WriteAllText("shockers.json", JsonConvert.SerializeObject(shocker));
OpenShockShocker deserialized = JsonConvert.DeserializeObject<OpenShockShocker>(File.ReadAllText("shockers.json"), new ApiJsonConverter())!;