From 18d3b6bf665101e2aed4c4f0514fcd841e537f2e Mon Sep 17 00:00:00 2001 From: glax Date: Fri, 19 Jan 2024 02:06:26 +0100 Subject: [PATCH] Update Dependency Cshocker Update Dependency CS2GSI Update README OpenShock now automatically gets shockerIds --- OpenCS2hock/OpenCS2hock.cs | 2 +- OpenCS2hock/OpenCS2hock.csproj | 4 ++-- OpenCS2hock/Setup.cs | 8 +++----- OpenCS2hock/ShockerAction.cs | 4 ++-- README.md | 34 +++++++++++++++++++++++++++------- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/OpenCS2hock/OpenCS2hock.cs b/OpenCS2hock/OpenCS2hock.cs index 7d8a871..9166ac3 100644 --- a/OpenCS2hock/OpenCS2hock.cs +++ b/OpenCS2hock/OpenCS2hock.cs @@ -2,7 +2,7 @@ using CS2GSI; using CShocker.Ranges; using CShocker.Shockers.Abstract; -using CS2Event = CS2GSI.CS2GSI.CS2Event; +using CS2Event = CS2GSI.CS2Event; namespace OpenCS2hock; diff --git a/OpenCS2hock/OpenCS2hock.csproj b/OpenCS2hock/OpenCS2hock.csproj index 007c8fa..fc150a4 100644 --- a/OpenCS2hock/OpenCS2hock.csproj +++ b/OpenCS2hock/OpenCS2hock.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/OpenCS2hock/Setup.cs b/OpenCS2hock/Setup.cs index 9ba3311..e8f7183 100644 --- a/OpenCS2hock/Setup.cs +++ b/OpenCS2hock/Setup.cs @@ -4,7 +4,7 @@ using CShocker.Shockers; using CShocker.Shockers.Abstract; using CShocker.Shockers.APIS; using Microsoft.Extensions.Logging; -using CS2Event = CS2GSI.CS2GSI.CS2Event; +using CS2Event = CS2GSI.CS2Event; namespace OpenCS2hock; @@ -117,18 +117,16 @@ public static class Setup Shocker newShocker; DurationRange durationRange; IntensityRange intensityRange; - List shockerIds; + List 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:",""); - Console.WriteLine("Shocker IDs associated with this API:"); - shockerIds = AddShockerIds(); 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"); diff --git a/OpenCS2hock/ShockerAction.cs b/OpenCS2hock/ShockerAction.cs index d68eddb..eb2f6f7 100644 --- a/OpenCS2hock/ShockerAction.cs +++ b/OpenCS2hock/ShockerAction.cs @@ -1,5 +1,5 @@ -using CShocker.Shockers; -using CS2Event = CS2GSI.CS2GSI.CS2Event; +using CS2GSI; +using CShocker.Shockers; namespace OpenCS2hock; diff --git a/README.md b/README.md index d802921..263876f 100644 --- a/README.md +++ b/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) +## 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. 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 -`0-100`% +in percent + +`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) -### Values for `Actions` +### ShockerIds +List of Shocker-Ids, comma seperated. (Same as in configured Shocker) + +`[ "ID-1", "ID-2" ]` + +### 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 Range) +Use CS2GSI EventArgs value to determine Intensity (within configured IntensityRange) # Using ### CS2GSI -[![GitHub License](https://img.shields.io/github/license/c9glax/CS2GSI)](/LICENSE) +[![GitHub License](https://img.shields.io/github/license/c9glax/CS2GSI)](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)