CShock/TestApp/Program.cs

29 lines
1.1 KiB
C#
Raw Normal View History

2024-01-20 20:02:12 +01:00
using CShocker.Ranges;
using CShocker.Shockers.Abstract;
using CShocker.Shockers.APIS;
using Microsoft.Extensions.Logging;
2024-01-20 20:21:23 +01:00
using TestApp;
2024-01-20 20:02:12 +01:00
Logger logger = new (LogLevel.Trace);
#pragma warning disable CA1416
2024-01-28 19:26:42 +01:00
List<SerialDevice.SerialPortInfo> serialPorts = SerialDevice.GetSerialPorts();
2024-01-20 20:02:12 +01:00
if (serialPorts.Count < 1)
return;
for(int i = 0; i < serialPorts.Count; i++)
Console.WriteLine($"{i}) {serialPorts[i]}");
Console.WriteLine($"Select Serial Port [0-{serialPorts.Count-1}]:");
string? selectedPortStr = Console.ReadLine();
int selectedPort = -1;
while (!int.TryParse(selectedPortStr, out selectedPort) || selectedPort < 0 || selectedPort > serialPorts.Count - 1)
{
Console.WriteLine($"Select Serial Port [0-{serialPorts.Count-1}]:");
selectedPortStr = Console.ReadLine();
}
OpenShockSerial shockSerial = new (new Dictionary<string, OpenShockSerial.ShockerModel>(), new IntensityRange(30,50), new DurationRange(1000,1000), serialPorts[selectedPort], logger);
2024-01-28 19:26:42 +01:00
Dictionary<string, OpenShockSerial.ShockerModel> shockers = shockSerial.GetShockers("https://api.shocklink.net", "LOLAPIKEY");
2024-01-20 20:02:12 +01:00
Console.ReadKey();