4 Commits

Author SHA1 Message Date
92cc79f707 Improved Setup
Update Dependency
2024-01-19 03:08:03 +01:00
6778375f43 Fix Dependency 2024-01-19 02:22:17 +01:00
0dcee037fc Update Readme 2024-01-19 02:22:12 +01:00
ee0ca69475 Fix wrong order of parameters 2024-01-19 02:13:25 +01:00
3 changed files with 15 additions and 12 deletions

View File

@ -11,7 +11,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="CS2GSI" Version="1.0.7" /> <PackageReference Include="CS2GSI" Version="1.0.7" />
<PackageReference Include="CShocker" Version="1.2.2" /> <PackageReference Include="CShocker" Version="1.2.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>

View File

@ -125,7 +125,7 @@ public static class Setup
apiKey = QueryString("OpenShock API-Key:",""); apiKey = QueryString("OpenShock API-Key:","");
intensityRange = GetIntensityRange(); intensityRange = GetIntensityRange();
durationRange = GetDurationRange(); durationRange = GetDurationRange();
newShocker = new OpenShockHttp(shockerIds, intensityRange, durationRange, apiUri, apiKey); newShocker = new OpenShockHttp(shockerIds, intensityRange, durationRange, apiKey, apiUri);
newShocker.ShockerIds.AddRange(((OpenShockHttp)newShocker).GetShockers()); newShocker.ShockerIds.AddRange(((OpenShockHttp)newShocker).GetShockers());
break; break;
case 3: //PiShock (HTTP) case 3: //PiShock (HTTP)
@ -218,23 +218,26 @@ public static class Setup
private static List<string> GetShockerIds(List<Shocker> shockers) private static List<string> GetShockerIds(List<Shocker> shockers)
{ {
List<string> allShockerIds = new();
foreach(Shocker shocker in shockers)
allShockerIds.AddRange(shocker.ShockerIds);
List<string> ids = new(); List<string> ids = new();
bool addAnother = true; bool addAnother = true;
while (ids.Count < 1 || addAnother) while (ids.Count < 1 || addAnother)
{ {
Console.WriteLine("Select Shocker API:");
for(int i = 0; i < shockers.Count; i++)
Console.WriteLine($"{i}) {shockers[i]}");
for (int i = 0; i < allShockerIds.Count; i++) int selectedShocker;
Console.WriteLine($"{i}) {allShockerIds[i]}"); while (!int.TryParse(Console.ReadLine(), out selectedShocker) || selectedShocker < 0 || selectedShocker >= shockers.Count)
Console.WriteLine("Select Shocker API:");
for (int i = 0; i < shockers[selectedShocker].ShockerIds.Count; i++)
Console.WriteLine($"{i}) {shockers[selectedShocker].ShockerIds[i]}");
int selectedIndex; int selectedIndex;
while (!int.TryParse(Console.ReadLine(), out selectedIndex) || selectedIndex < 0 || selectedIndex >= allShockerIds.Count) while (!int.TryParse(Console.ReadLine(), out selectedIndex) || selectedIndex < 0 || selectedIndex >= shockers[selectedShocker].ShockerIds.Count)
Console.WriteLine("Select ID:"); Console.WriteLine("Select ID:");
ids.Add(allShockerIds[selectedIndex]); ids.Add(shockers[selectedShocker].ShockerIds[selectedIndex]);
Console.WriteLine("Add another ID? (Y/N):"); Console.WriteLine("Add another ID? (Y/N):");
addAnother = Console.ReadKey().Key == ConsoleKey.Y; addAnother = Console.ReadKey().Key == ConsoleKey.Y;

View File

@ -49,8 +49,8 @@ Example `config.json`. Place next to executable. Will also be generated on first
## Shockers ## Shockers
### ApiKey ### ApiKey
For OpenShock (HTTP) get token [here](https://shocklink.net/#/dashboard/tokens) - For OpenShock (HTTP) get token [here](https://shocklink.net/#/dashboard/tokens)
For PiShock (HTTP) get information [here](https://apidocs.pishock.com/#header-authenticating) - For PiShock (HTTP) get information [here](https://apidocs.pishock.com/#header-authenticating)
### ApiType ### ApiType
CShocker [![Github](https://img.shields.io/badge/Github-8A2BE2)](https://github.com/C9Glax/cshocker) [here](https://github.com/C9Glax/CShocker/blob/master/CShocker/Shockers/Abstract/ShockerApi.cs) CShocker [![Github](https://img.shields.io/badge/Github-8A2BE2)](https://github.com/C9Glax/cshocker) [here](https://github.com/C9Glax/CShocker/blob/master/CShocker/Shockers/Abstract/ShockerApi.cs)