diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b39ed35..a0c9105 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v4 diff --git a/Docs/docs/Awake.md b/Docs/docs/Awake.md index bd58b47..e048379 100644 --- a/Docs/docs/Awake.md +++ b/Docs/docs/Awake.md @@ -62,18 +62,9 @@ Awake.CompleteExit(0, false, "AppName"); Updated version of Power Awake ```C# -using FrApps42.System.Computer.Awake.v1; +using FrApps42.System.Computer.Awake.v2; ... -private static void LogUnexpectedOrCancelledKeepAwakeThreadCompletion(){ - Console.WriteLine("The keep-awake thread was terminated early."); -} - -private static void LogCompletedKeepAwakeThread(bool result) -{ - Console.WriteLine($"Exited keep-awake thread successfully: {result}"); -} - // Keep Screen on Awake..SetIndefiniteKeepAwake(true); // Keep Screen off diff --git a/README.md b/README.md index 4dd1784..249c5e0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This repos contains tool classes in C# for multiple types of usage. * WakeOnLan: Power on a device with it mac address. * `FrApp42.Web` - [Link](https://www.nuget.org/packages/FrApp42.Web) - * Request: Make API request for any of your C# projects. ⚠️ *SOAP requests are not supported.* ⚠️ + * Request: Make API request for any of your C# projects. ## Authors * [AnthoDingo](https://github.com) diff --git a/System/System.csproj b/System/System.csproj index b898a2e..02e2c3d 100644 --- a/System/System.csproj +++ b/System/System.csproj @@ -9,7 +9,7 @@ FrApp42 System FrenchyApps42, Sikelio, AnthoDingo GPLv3 - https://github.com/FrApp42/Tools + https://frapp42.github.io/Tools/api.System/FrApp42.System.Computer.Awake.v1.html https://github.com/FrApp42/Tools.git git True @@ -22,7 +22,7 @@ logo.png 1.1.0 1.1.0 - Implement Awake from Microsoft Powertoys + Fix Awake v1 & v2 1.1.0 diff --git a/Web/API/Request.cs b/Web/API/Request.cs index f66fcb5..f9aa5cc 100644 --- a/Web/API/Request.cs +++ b/Web/API/Request.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json; using System.Net.Http.Headers; using System.Text; +using System.Xml.Serialization; namespace FrApp42.Web.API { @@ -392,8 +393,24 @@ private async Task> Process(HttpRequestMessage request) if (response.IsSuccessStatusCode) { - Stream ContentResponse = await response.Content?.ReadAsStreamAsync(); - result.Value = await System.Text.Json.JsonSerializer.DeserializeAsync(ContentResponse); + string MediaType = response.Content?.Headers?.ContentType?.MediaType.ToLower(); + string ContentResponse = await response.Content?.ReadAsStringAsync(); + + switch (true) + { + case bool b when (MediaType.Contains("application/xml")): + XmlSerializer xmlSerializer = new(typeof(T)); + StringReader reader = new(ContentResponse); + + result.Value = (T)xmlSerializer.Deserialize(reader); + break; + case bool b when (MediaType.Contains("application/json")): + result.Value = JsonConvert.DeserializeObject(ContentResponse); + break; + default: + result.Value = default; + break; + } } else { diff --git a/Web/Web.csproj b/Web/Web.csproj index 238166c..09b1be9 100644 --- a/Web/Web.csproj +++ b/Web/Web.csproj @@ -9,7 +9,7 @@ FrApp42 Web FrenchyApps42, Sikelio, AnthoDingo GPLv3 - https://github.com/FrApp42/Tools + https://frapp42.github.io/Tools/api.Web/FrApp42.Web.API.html https://github.com/FrApp42/Tools.git git True @@ -20,7 +20,7 @@ README.md FrenchyApps42 logo.png - 1.1.0 + 1.2.0