diff --git a/CShocker.sln.DotSettings.user b/CShocker.sln.DotSettings.user index 0f66c07..5705f12 100644 --- a/CShocker.sln.DotSettings.user +++ b/CShocker.sln.DotSettings.user @@ -1,5 +1,6 @@  True + ForceIncluded <AssemblyExplorer> <Assembly Path="C:\Users\Glax\RiderProjects\GlaxLogger\GlaxLogger\bin\Debug\net7.0\GlaxLogger.dll" /> </AssemblyExplorer> \ No newline at end of file diff --git a/CShocker/CShocker.csproj b/CShocker/CShocker.csproj index ac1b4b1..75df0e4 100644 --- a/CShocker/CShocker.csproj +++ b/CShocker/CShocker.csproj @@ -1,20 +1,22 @@ - net7.0 enable enable Glax https://github.com/C9Glax/CShocker git - 2.5.1 + 3.0.0 + net8.0;net9.0 + latestmajor + https://github.com/C9Glax/CShocker - + - - + + diff --git a/CShocker/Devices/Abstract/Api.cs b/CShocker/Devices/Abstract/Api.cs index 71bf305..d4552c5 100644 --- a/CShocker/Devices/Abstract/Api.cs +++ b/CShocker/Devices/Abstract/Api.cs @@ -59,7 +59,7 @@ public abstract class Api : IDisposable while (_workOnQueue) if (_queue.Count > 0 && _queue.Dequeue() is { } action) { - this.Logger?.Log(LogLevel.Information, $"Executing: {Enum.GetName(action.Item1)} Intensity: {action.Item3} Duration: {action.Item4}\nShocker:\n{action.Item2.ToString()}"); + this.Logger?.Log(LogLevel.Information, $"Executing: {Enum.GetName(action.Item1)} Intensity: {action.Item3} Duration: {action.Item4}\nShocker:\n{action.Item2}"); ControlInternal(action.Item1, action.Item2, action.Item3, action.Item4); Thread.Sleep(action.Item4 + CommandDelay); } diff --git a/CShocker/Devices/Additional/ApiHttpClient.cs b/CShocker/Devices/Additional/ApiHttpClient.cs index cca3053..2808b44 100644 --- a/CShocker/Devices/Additional/ApiHttpClient.cs +++ b/CShocker/Devices/Additional/ApiHttpClient.cs @@ -38,10 +38,10 @@ public static class ApiHttpClient HttpClient httpClient = new(); HttpResponseMessage response = httpClient.Send(request); logger?.Log(!response.IsSuccessStatusCode ? LogLevel.Error : LogLevel.Debug, string.Join("\n\t", - "Request:", + "Response:", $"\u251c\u2500\u2500 URI: {request.RequestUri}", $"\u251c\u2500\u2510 Headers: {string.Concat(response.Headers.Select(h => $"\n\t\u2502 {(response.Headers.Last().Key.Equals(h.Key) ? "\u2514" : "\u251c")} {h.Key}: {string.Join(", ", h.Value)}"))}", - $"\u2514\u2500\u2500 Content: {response.Content?.ReadAsStringAsync().Result}")); + $"\u2514\u2500\u2500 Content: {response.Content.ReadAsStringAsync().Result}")); httpClient.Dispose(); return response; } diff --git a/TestApp/Program.cs b/TestApp/Program.cs index 36a4f33..024821d 100644 --- a/TestApp/Program.cs +++ b/TestApp/Program.cs @@ -3,7 +3,6 @@ using CShocker.Devices.APIs; using CShocker.Shockers; using GlaxLogger; using Microsoft.Extensions.Logging; -using Newtonsoft.Json; Logger logger = new (LogLevel.Trace); @@ -14,9 +13,11 @@ while(apiKey is null || apiKey.Length < 1) OpenShockHttp openShockHttp = new (apiKey, logger: logger); -OpenShockShocker shocker = openShockHttp.GetShockers().First(); -shocker.Control(ControlAction.Vibrate, 20, 1000); -Thread.Sleep(1100); +foreach (OpenShockShocker shocker in openShockHttp.GetShockers()) +{ + shocker.Control(ControlAction.Vibrate, 20, 1000); + Thread.Sleep(1100); +} /* File.WriteAllText("shockers.json", JsonConvert.SerializeObject(shocker)); @@ -54,5 +55,3 @@ OpenShockShocker deserialized = JsonConvert.DeserializeObject( shocker.Dispose(); deserialized.Dispose(); */ - -logger.Dispose(); \ No newline at end of file diff --git a/TestApp/TestApp.csproj b/TestApp/TestApp.csproj index de59f6c..56335cc 100644 --- a/TestApp/TestApp.csproj +++ b/TestApp/TestApp.csproj @@ -2,9 +2,10 @@ Exe - net7.0 enable enable + net8.0;net9.0 + latestmajor @@ -12,7 +13,7 @@ - +