diff --git a/.editorconfig b/.editorconfig index 3f89b9a..f6b2fa2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,7 +15,7 @@ root = true # Defaults [*] -charset = utf-8-bom +charset = utf-8 end_of_line = crlf indent_size = 4 indent_style = space diff --git a/Sandbox/Program.cs b/Sandbox/Program.cs index 68250dd..bdfb950 100644 --- a/Sandbox/Program.cs +++ b/Sandbox/Program.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.IO; using System.Reflection; using InsaneGenius.Utilities; diff --git a/Utilities/CommandLineEx.cs b/Utilities/CommandLineEx.cs index 6ee61e9..a1230e1 100644 --- a/Utilities/CommandLineEx.cs +++ b/Utilities/CommandLineEx.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace InsaneGenius.Utilities; diff --git a/Utilities/ConsoleEx.cs b/Utilities/ConsoleEx.cs index 1a2fba0..4a8a8c1 100644 --- a/Utilities/ConsoleEx.cs +++ b/Utilities/ConsoleEx.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Globalization; using System.Threading; diff --git a/Utilities/Download.cs b/Utilities/Download.cs index 480c691..defdfef 100644 --- a/Utilities/Download.cs +++ b/Utilities/Download.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Net.Http; using System.Net.Http.Headers; @@ -15,8 +15,11 @@ public static bool GetContentInfo(Uri uri, out long size, out DateTime modifiedT try { // Send GET to URL - using HttpResponseMessage httpResponse = GetHttpClient().GetAsync(uri).Result; - _ = httpResponse.EnsureSuccessStatusCode(); + using HttpResponseMessage httpResponse = GetHttpClient() + .GetAsync(uri) + .GetAwaiter() + .GetResult() + .EnsureSuccessStatusCode(); // Get response size = (long)httpResponse.Content.Headers.ContentLength; @@ -36,7 +39,7 @@ public static bool DownloadFile(Uri uri, string fileName) try { // Get HTTP stream - Stream httpStream = GetHttpClient().GetStreamAsync(uri).Result; + Stream httpStream = GetHttpClient().GetStreamAsync(uri).GetAwaiter().GetResult(); // Get file stream using FileStream fileStream = File.OpenWrite(fileName); @@ -58,7 +61,7 @@ public static bool DownloadString(Uri uri, out string value) value = null; try { - value = GetHttpClient().GetStringAsync(uri).Result; + value = GetHttpClient().GetStringAsync(uri).GetAwaiter().GetResult(); } catch (Exception e) when (LogOptions.Logger.LogAndHandle(e, MethodBase.GetCurrentMethod()?.Name)) diff --git a/Utilities/Extensions.cs b/Utilities/Extensions.cs index 09094c4..cd4eded 100644 --- a/Utilities/Extensions.cs +++ b/Utilities/Extensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using Serilog; namespace InsaneGenius.Utilities; diff --git a/Utilities/FileEx.cs b/Utilities/FileEx.cs index 2597ed5..42237f4 100644 --- a/Utilities/FileEx.cs +++ b/Utilities/FileEx.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/Utilities/FileExOptions.cs b/Utilities/FileExOptions.cs index a07809c..02a6eab 100644 --- a/Utilities/FileExOptions.cs +++ b/Utilities/FileExOptions.cs @@ -1,4 +1,4 @@ -using System.Threading; +using System.Threading; namespace InsaneGenius.Utilities; diff --git a/Utilities/Format.cs b/Utilities/Format.cs index 967aaa5..b66dcf6 100644 --- a/Utilities/Format.cs +++ b/Utilities/Format.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace InsaneGenius.Utilities; diff --git a/Utilities/Iso6392.cs b/Utilities/Iso6392.cs index ea1b4bf..bf30c42 100644 --- a/Utilities/Iso6392.cs +++ b/Utilities/Iso6392.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/Utilities/Iso6393.cs b/Utilities/Iso6393.cs index f6b874b..1917612 100644 --- a/Utilities/Iso6393.cs +++ b/Utilities/Iso6393.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/Utilities/LogOptions.cs b/Utilities/LogOptions.cs index a944544..024e672 100644 --- a/Utilities/LogOptions.cs +++ b/Utilities/LogOptions.cs @@ -1,4 +1,4 @@ -// TODO: Problematic when used in different environments +// TODO: Problematic when used in different environments // using Microsoft.Extensions.Logging; using Serilog; diff --git a/Utilities/ProcessEx.cs b/Utilities/ProcessEx.cs index 8ecc860..f378960 100644 --- a/Utilities/ProcessEx.cs +++ b/Utilities/ProcessEx.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.IO; using System.Reflection; @@ -9,7 +9,7 @@ namespace InsaneGenius.Utilities; public class ProcessEx : Process { public int ExecuteEx(string executable, string parameters) => - ExecuteExAsync(executable, parameters).Result; + ExecuteExAsync(executable, parameters).GetAwaiter().GetResult(); public async Task ExecuteExAsync(string executable, string parameters) { diff --git a/Utilities/Rfc5646.cs b/Utilities/Rfc5646.cs index 52d8866..3466138 100644 --- a/Utilities/Rfc5646.cs +++ b/Utilities/Rfc5646.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; diff --git a/Utilities/StringCompression.cs b/Utilities/StringCompression.cs index 4ae33f6..51d0092 100644 --- a/Utilities/StringCompression.cs +++ b/Utilities/StringCompression.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.IO.Compression; using System.Text; diff --git a/Utilities/StringHistory.cs b/Utilities/StringHistory.cs index 8be21fc..23a8a35 100644 --- a/Utilities/StringHistory.cs +++ b/Utilities/StringHistory.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; namespace InsaneGenius.Utilities; diff --git a/UtilitiesTests/CommandLineTests.cs b/UtilitiesTests/CommandLineTests.cs index c3bb09b..c4683f2 100644 --- a/UtilitiesTests/CommandLineTests.cs +++ b/UtilitiesTests/CommandLineTests.cs @@ -1,4 +1,4 @@ -using Xunit; +using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/ConsoleTests.cs b/UtilitiesTests/ConsoleTests.cs index d30f99f..f587685 100644 --- a/UtilitiesTests/ConsoleTests.cs +++ b/UtilitiesTests/ConsoleTests.cs @@ -1,4 +1,4 @@ -using Xunit; +using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/DownloadTests.cs b/UtilitiesTests/DownloadTests.cs index 4c1d48f..377b37e 100644 --- a/UtilitiesTests/DownloadTests.cs +++ b/UtilitiesTests/DownloadTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/FileTests.cs b/UtilitiesTests/FileTests.cs index fbd38c3..bb002f5 100644 --- a/UtilitiesTests/FileTests.cs +++ b/UtilitiesTests/FileTests.cs @@ -1,4 +1,4 @@ -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/FormatTests.cs b/UtilitiesTests/FormatTests.cs index 8acb694..e42ec72 100644 --- a/UtilitiesTests/FormatTests.cs +++ b/UtilitiesTests/FormatTests.cs @@ -1,4 +1,4 @@ -using Xunit; +using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/Iso6392Tests.cs b/UtilitiesTests/Iso6392Tests.cs index 9eff2b6..52a8e24 100644 --- a/UtilitiesTests/Iso6392Tests.cs +++ b/UtilitiesTests/Iso6392Tests.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; using Xunit; diff --git a/UtilitiesTests/Iso6393Tests.cs b/UtilitiesTests/Iso6393Tests.cs index c39b0b6..5e9b204 100644 --- a/UtilitiesTests/Iso6393Tests.cs +++ b/UtilitiesTests/Iso6393Tests.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; using Xunit; diff --git a/UtilitiesTests/Rfc5646Tests.cs b/UtilitiesTests/Rfc5646Tests.cs index f48d50e..89b42a9 100644 --- a/UtilitiesTests/Rfc5646Tests.cs +++ b/UtilitiesTests/Rfc5646Tests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Reflection; using Xunit; diff --git a/UtilitiesTests/StringCompressionTests.cs b/UtilitiesTests/StringCompressionTests.cs index b1f09ef..20d44cc 100644 --- a/UtilitiesTests/StringCompressionTests.cs +++ b/UtilitiesTests/StringCompressionTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/UtilitiesTests.cs b/UtilitiesTests/UtilitiesTests.cs index f37b15f..6e283c9 100644 --- a/UtilitiesTests/UtilitiesTests.cs +++ b/UtilitiesTests/UtilitiesTests.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/UtilitiesTests.csproj b/UtilitiesTests/UtilitiesTests.csproj index f56d8a6..bf27233 100644 --- a/UtilitiesTests/UtilitiesTests.csproj +++ b/UtilitiesTests/UtilitiesTests.csproj @@ -25,7 +25,7 @@ - +