Add PiShockHttp
This commit is contained in:
parent
4039455bfd
commit
968c3a5c37
@ -105,31 +105,45 @@ public static class Setup
|
|||||||
{
|
{
|
||||||
Console.WriteLine("Select API:");
|
Console.WriteLine("Select API:");
|
||||||
Console.WriteLine("1) OpenShock (HTTP)");
|
Console.WriteLine("1) OpenShock (HTTP)");
|
||||||
Console.WriteLine("2) OpenShock (Serial)");
|
Console.WriteLine("2) OpenShock (Serial) NotImplemented"); //TODO
|
||||||
Console.WriteLine("3) PiShock (HTTP)");
|
Console.WriteLine("3) PiShock (HTTP)");
|
||||||
Console.WriteLine("4) PiShock (Serial)");
|
Console.WriteLine("4) PiShock (Serial) NotImplemented"); //TODO
|
||||||
string? selectedChar = Console.ReadLine();
|
string? selectedChar = Console.ReadLine();
|
||||||
int selected;
|
int selected;
|
||||||
while (!int.TryParse(selectedChar, out selected) || selected < 1 || selected > 1)
|
while (!int.TryParse(selectedChar, out selected) || (selected != 1 && selected != 3))
|
||||||
selectedChar = Console.ReadLine();
|
selectedChar = Console.ReadLine();
|
||||||
|
|
||||||
|
string apiUri, apiKey;
|
||||||
Shocker newShocker;
|
Shocker newShocker;
|
||||||
|
DurationRange durationRange;
|
||||||
|
IntensityRange intensityRange;
|
||||||
|
List<string> shockerIds;
|
||||||
switch (selected)
|
switch (selected)
|
||||||
{
|
{
|
||||||
case 1: //OpenShock (HTTP)
|
case 1: //OpenShock (HTTP)
|
||||||
string apiUri = QueryString("OpenShock API-Endpoint (https://api.shocklink.net):",
|
apiUri = QueryString("OpenShock API-Endpoint (https://api.shocklink.net):", "https://api.shocklink.net");
|
||||||
"https://api.shocklink.net");
|
apiKey = QueryString("OpenShock API-Key:","");
|
||||||
string apiKey = QueryString("OpenShock API-Key:","");
|
|
||||||
Console.WriteLine("Shocker IDs associated with this API:");
|
Console.WriteLine("Shocker IDs associated with this API:");
|
||||||
List<string> shockerIds = AddShockerIds();
|
shockerIds = AddShockerIds();
|
||||||
IntensityRange intensityRange = GetIntensityRange();
|
intensityRange = GetIntensityRange();
|
||||||
DurationRange durationRange = GetDurationRange();
|
durationRange = GetDurationRange();
|
||||||
|
|
||||||
newShocker = new OpenShockHttp(shockerIds, intensityRange, durationRange, apiUri, apiKey);
|
newShocker = new OpenShockHttp(shockerIds, intensityRange, durationRange, apiUri, apiKey);
|
||||||
break;
|
break;
|
||||||
|
case 3: //PiShock (HTTP)
|
||||||
|
apiUri = QueryString("PiShock API-Endpoint (https://do.pishock.com/api/apioperate):", "https://do.pishock.com/api/apioperate");
|
||||||
|
apiKey = QueryString("PiShock API-Key:","");
|
||||||
|
string username = QueryString("Username:","");
|
||||||
|
string shareCode = QueryString("Sharecode:","");
|
||||||
|
Console.WriteLine("Shocker IDs associated with this API:");
|
||||||
|
shockerIds = AddShockerIds();
|
||||||
|
intensityRange = GetIntensityRange();
|
||||||
|
durationRange = GetDurationRange();
|
||||||
|
|
||||||
|
newShocker = new PiShockHttp(shockerIds, intensityRange, durationRange, apiKey, username, shareCode, apiUri);
|
||||||
|
break;
|
||||||
// ReSharper disable thrice RedundantCaseLabel
|
// ReSharper disable thrice RedundantCaseLabel
|
||||||
case 2: //OpenShock (Serial)
|
case 2: //OpenShock (Serial)
|
||||||
case 3: //PiShock (HTTP)
|
|
||||||
case 4: //PiShock (Serial)
|
case 4: //PiShock (Serial)
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user