Compare commits
5 Commits
b196f62111
...
18d3b6bf66
Author | SHA1 | Date | |
---|---|---|---|
18d3b6bf66 | |||
d040995051 | |||
dbb0bcd89f | |||
968c3a5c37 | |||
4039455bfd |
@ -6,5 +6,6 @@
|
|||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=libraryfolders/@EntryIndexedValue">True</s:Boolean>
|
<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/=NYAA/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=OpenCS2hock/@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/=steamapps/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=steamid/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=steamid/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
@ -31,6 +31,8 @@ public struct Configuration
|
|||||||
Setup.Run().SaveConfiguration();
|
Setup.Run().SaveConfiguration();
|
||||||
|
|
||||||
Configuration c = JsonConvert.DeserializeObject<Configuration>(File.ReadAllText(settingsFilePath), new CShocker.Shockers.ShockerJsonConverter());
|
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)
|
foreach (Shocker cShocker in c.Shockers)
|
||||||
cShocker.SetLogger(logger);
|
cShocker.SetLogger(logger);
|
||||||
return c;
|
return c;
|
||||||
@ -41,4 +43,9 @@ public struct Configuration
|
|||||||
string settingsFilePath = path ?? "config.json";
|
string settingsFilePath = path ?? "config.json";
|
||||||
File.WriteAllText(settingsFilePath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
File.WriteAllText(settingsFilePath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ConfigurationValid()
|
||||||
|
{
|
||||||
|
return true; //TODO Check values
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
using CS2GSI;
|
using CS2GSI;
|
||||||
using CShocker.Ranges;
|
using CShocker.Ranges;
|
||||||
using CShocker.Shockers.Abstract;
|
using CShocker.Shockers.Abstract;
|
||||||
using CS2Event = CS2GSI.CS2GSI.CS2Event;
|
using CS2Event = CS2GSI.CS2Event;
|
||||||
|
|
||||||
namespace OpenCS2hock;
|
namespace OpenCS2hock;
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CS2GSI" Version="1.0.6" />
|
<PackageReference Include="CS2GSI" Version="1.0.7" />
|
||||||
<PackageReference Include="CShocker" Version="1.1.11" />
|
<PackageReference Include="CShocker" Version="1.2.2" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ using CShocker.Shockers;
|
|||||||
using CShocker.Shockers.Abstract;
|
using CShocker.Shockers.Abstract;
|
||||||
using CShocker.Shockers.APIS;
|
using CShocker.Shockers.APIS;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using CS2Event = CS2GSI.CS2GSI.CS2Event;
|
using CS2Event = CS2GSI.CS2Event;
|
||||||
|
|
||||||
namespace OpenCS2hock;
|
namespace OpenCS2hock;
|
||||||
|
|
||||||
@ -105,31 +105,43 @@ 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 = new();
|
||||||
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:","");
|
intensityRange = GetIntensityRange();
|
||||||
Console.WriteLine("Shocker IDs associated with this API:");
|
durationRange = GetDurationRange();
|
||||||
List<string> shockerIds = AddShockerIds();
|
|
||||||
IntensityRange intensityRange = GetIntensityRange();
|
|
||||||
DurationRange durationRange = GetDurationRange();
|
|
||||||
|
|
||||||
newShocker = new OpenShockHttp(shockerIds, intensityRange, durationRange, apiUri, apiKey);
|
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:","");
|
||||||
|
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;
|
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();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using CShocker.Shockers;
|
using CS2GSI;
|
||||||
using CS2Event = CS2GSI.CS2GSI.CS2Event;
|
using CShocker.Shockers;
|
||||||
|
|
||||||
namespace OpenCS2hock;
|
namespace OpenCS2hock;
|
||||||
|
|
||||||
|
34
README.md
34
README.md
@ -43,38 +43,58 @@ 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)
|
[Levels](https://learn.microsoft.com/de-de/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-8.0)
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
### ApiType
|
### ApiType
|
||||||
CShocker [](https://github.com/C9Glax/cshocker) [here](https://github.com/C9Glax/CShocker/blob/master/CShocker/Shockers/Abstract/ShockerApi.cs)
|
CShocker [](https://github.com/C9Glax/cshocker) [here](https://github.com/C9Glax/CShocker/blob/master/CShocker/Shockers/Abstract/ShockerApi.cs)
|
||||||
|
|
||||||
### ShockerIds
|
### ShockerIds
|
||||||
List of Shocker-Ids, comma seperated. Get ID of shocker [here](https://shocklink.net/#/dashboard/shockers/own). Press the three dots -> Edit
|
List of Shocker-Ids, comma seperated.
|
||||||
|
|
||||||
Example `[ "ID-1", "ID-2" ]`
|
`[ "ID-1-asdasd", "ID-2-fghfgh" ]`
|
||||||
|
|
||||||
### Intensity Range
|
### Intensity Range
|
||||||
`0-100`%
|
in percent
|
||||||
|
|
||||||
|
`0-100`
|
||||||
|
|
||||||
### Duration Range
|
### Duration Range
|
||||||
in ms
|
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
|
### TriggerEvent IDs
|
||||||
From CS2GSI [](https://github.com/C9Glax/CS2GSI) [here](https://github.com/C9Glax/CS2GSI/blob/master/CS2GSI/CS2Event.cs)
|
From CS2GSI [](https://github.com/C9Glax/CS2GSI) [here](https://github.com/C9Glax/CS2GSI/blob/master/CS2GSI/CS2Event.cs)
|
||||||
|
|
||||||
### Values for `Actions`
|
### ShockerIds
|
||||||
|
List of Shocker-Ids, comma seperated. (Same as in configured Shocker)
|
||||||
|
|
||||||
|
`[ "ID-1", "ID-2" ]`
|
||||||
|
|
||||||
|
### Actions
|
||||||
From CShocker [](https://github.com/C9Glax/cshocker) [here](https://github.com/C9Glax/CShocker/blob/master/CShocker/Shockers/ControlAction.cs)
|
From CShocker [](https://github.com/C9Glax/cshocker) [here](https://github.com/C9Glax/CShocker/blob/master/CShocker/Shockers/ControlAction.cs)
|
||||||
|
|
||||||
### ValueFromInput
|
### ValueFromInput
|
||||||
Use CS2GSI EventArgs value to determine Intensity (within configured Range)
|
Use CS2GSI EventArgs value to determine Intensity (within configured IntensityRange)
|
||||||
|
|
||||||
# Using
|
# Using
|
||||||
### CS2GSI
|
### CS2GSI
|
||||||
[](/LICENSE)
|
[](https://img.shields.io/github/license/c9glax/CS2GSI/LICENSE)
|
||||||
[](https://www.nuget.org/packages/CS2GSI/)
|
[](https://www.nuget.org/packages/CS2GSI/)
|
||||||
[](https://github.com/C9Glax/CS2GSI)
|
[](https://github.com/C9Glax/CS2GSI)
|
||||||
[](https://github.com/C9Glax/CS2GSI/releases/latest)
|
[](https://github.com/C9Glax/CS2GSI/releases/latest)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user