Compare commits

..

No commits in common. "18d3b6bf665101e2aed4c4f0514fcd841e537f2e" and "b196f62111f509ca783395ce241e3c7b5d3b425a" have entirely different histories.

7 changed files with 24 additions and 64 deletions

View File

@ -6,6 +6,5 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=libraryfolders/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=NYAA/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=OpenCS2hock/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sharecode/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=steamapps/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=steamid/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -31,8 +31,6 @@ public struct Configuration
Setup.Run().SaveConfiguration();
Configuration c = JsonConvert.DeserializeObject<Configuration>(File.ReadAllText(settingsFilePath), new CShocker.Shockers.ShockerJsonConverter());
if (!c.ConfigurationValid())
throw new Exception("Configuration validation failed.");
foreach (Shocker cShocker in c.Shockers)
cShocker.SetLogger(logger);
return c;
@ -43,9 +41,4 @@ public struct Configuration
string settingsFilePath = path ?? "config.json";
File.WriteAllText(settingsFilePath, JsonConvert.SerializeObject(this, Formatting.Indented));
}
private bool ConfigurationValid()
{
return true; //TODO Check values
}
}

View File

@ -2,7 +2,7 @@
using CS2GSI;
using CShocker.Ranges;
using CShocker.Shockers.Abstract;
using CS2Event = CS2GSI.CS2Event;
using CS2Event = CS2GSI.CS2GSI.CS2Event;
namespace OpenCS2hock;

View File

@ -10,8 +10,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CS2GSI" Version="1.0.7" />
<PackageReference Include="CShocker" Version="1.2.2" />
<PackageReference Include="CS2GSI" Version="1.0.6" />
<PackageReference Include="CShocker" Version="1.1.11" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@ -4,7 +4,7 @@ using CShocker.Shockers;
using CShocker.Shockers.Abstract;
using CShocker.Shockers.APIS;
using Microsoft.Extensions.Logging;
using CS2Event = CS2GSI.CS2Event;
using CS2Event = CS2GSI.CS2GSI.CS2Event;
namespace OpenCS2hock;
@ -105,43 +105,31 @@ public static class Setup
{
Console.WriteLine("Select API:");
Console.WriteLine("1) OpenShock (HTTP)");
Console.WriteLine("2) OpenShock (Serial) NotImplemented"); //TODO
Console.WriteLine("2) OpenShock (Serial)");
Console.WriteLine("3) PiShock (HTTP)");
Console.WriteLine("4) PiShock (Serial) NotImplemented"); //TODO
Console.WriteLine("4) PiShock (Serial)");
string? selectedChar = Console.ReadLine();
int selected;
while (!int.TryParse(selectedChar, out selected) || (selected != 1 && selected != 3))
while (!int.TryParse(selectedChar, out selected) || selected < 1 || selected > 1)
selectedChar = Console.ReadLine();
string apiUri, apiKey;
Shocker newShocker;
DurationRange durationRange;
IntensityRange intensityRange;
List<string> shockerIds = new();
switch (selected)
{
case 1: //OpenShock (HTTP)
apiUri = QueryString("OpenShock API-Endpoint (https://api.shocklink.net):", "https://api.shocklink.net");
apiKey = QueryString("OpenShock API-Key:","");
intensityRange = GetIntensityRange();
durationRange = GetDurationRange();
newShocker = new OpenShockHttp(shockerIds, intensityRange, durationRange, apiUri, apiKey);
newShocker.ShockerIds.AddRange(((OpenShockHttp)newShocker).GetShockers());
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:","");
string apiUri = QueryString("OpenShock API-Endpoint (https://api.shocklink.net):",
"https://api.shocklink.net");
string apiKey = QueryString("OpenShock API-Key:","");
Console.WriteLine("Shocker IDs associated with this API:");
shockerIds = AddShockerIds();
intensityRange = GetIntensityRange();
durationRange = GetDurationRange();
List<string> shockerIds = AddShockerIds();
IntensityRange intensityRange = GetIntensityRange();
DurationRange durationRange = GetDurationRange();
newShocker = new PiShockHttp(shockerIds, intensityRange, durationRange, apiKey, username, shareCode, apiUri);
newShocker = new OpenShockHttp(shockerIds, intensityRange, durationRange, apiUri, apiKey);
break;
// ReSharper disable thrice RedundantCaseLabel
case 2: //OpenShock (Serial)
case 3: //PiShock (HTTP)
case 4: //PiShock (Serial)
default:
throw new NotImplementedException();

View File

@ -1,5 +1,5 @@
using CS2GSI;
using CShocker.Shockers;
using CShocker.Shockers;
using CS2Event = CS2GSI.CS2GSI.CS2Event;
namespace OpenCS2hock;

View File

@ -43,58 +43,38 @@ Example `config.json`. Place next to executable. Will also be generated on first
}
```
## LogLevel
### LogLevel
[Levels](https://learn.microsoft.com/de-de/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-8.0)
## Shockers
### ApiKey
For OpenShock (HTTP) get token [here](https://shocklink.net/#/dashboard/tokens)
For PiShock (HTTP) get information [here](https://apidocs.pishock.com/#header-authenticating)
### 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)
### ShockerIds
List of Shocker-Ids, comma seperated.
List of Shocker-Ids, comma seperated. Get ID of shocker [here](https://shocklink.net/#/dashboard/shockers/own). Press the three dots -> Edit
`[ "ID-1-asdasd", "ID-2-fghfgh" ]`
Example `[ "ID-1", "ID-2" ]`
### Intensity Range
in percent
`0-100`
`0-100`%
### Duration Range
in ms
- `0-30000` OpenShock
- `0-15000` PiShock
### Username (PiShockHttp only)
For PiShock (HTTP) get information [here](https://apidocs.pishock.com/#header-authenticating)
### Sharecode (PiShockHttp only)
For PiShock (HTTP) get information [here](https://apidocs.pishock.com/#header-authenticating)
## ShockerActions
### TriggerEvent IDs
From CS2GSI [![Github](https://img.shields.io/badge/Github-8A2BE2)](https://github.com/C9Glax/CS2GSI) [here](https://github.com/C9Glax/CS2GSI/blob/master/CS2GSI/CS2Event.cs)
### ShockerIds
List of Shocker-Ids, comma seperated. (Same as in configured Shocker)
`[ "ID-1", "ID-2" ]`
### Actions
### Values for `Actions`
From CShocker [![Github](https://img.shields.io/badge/Github-8A2BE2)](https://github.com/C9Glax/cshocker) [here](https://github.com/C9Glax/CShocker/blob/master/CShocker/Shockers/ControlAction.cs)
### ValueFromInput
Use CS2GSI EventArgs value to determine Intensity (within configured IntensityRange)
Use CS2GSI EventArgs value to determine Intensity (within configured Range)
# Using
### CS2GSI
[![GitHub License](https://img.shields.io/github/license/c9glax/CS2GSI)](https://img.shields.io/github/license/c9glax/CS2GSI/LICENSE)
[![GitHub License](https://img.shields.io/github/license/c9glax/CS2GSI)](/LICENSE)
[![NuGet Version](https://img.shields.io/nuget/v/CS2GSI)](https://www.nuget.org/packages/CS2GSI/)
[![Github](https://img.shields.io/badge/Github-8A2BE2)](https://github.com/C9Glax/CS2GSI)
[![GitHub Release](https://img.shields.io/github/v/release/c9glax/CS2GSI)](https://github.com/C9Glax/CS2GSI/releases/latest)