Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ root = true

# Defaults
[*]
charset = utf-8-bom
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = space
Expand Down
2 changes: 1 addition & 1 deletion Sandbox/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using InsaneGenius.Utilities;
Expand Down
2 changes: 1 addition & 1 deletion Utilities/CommandLineEx.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace InsaneGenius.Utilities;

Expand Down
2 changes: 1 addition & 1 deletion Utilities/ConsoleEx.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Globalization;
using System.Threading;

Expand Down
13 changes: 8 additions & 5 deletions Utilities/Download.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion Utilities/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Serilog;

namespace InsaneGenius.Utilities;
Expand Down
2 changes: 1 addition & 1 deletion Utilities/FileEx.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down
2 changes: 1 addition & 1 deletion Utilities/FileExOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Threading;
using System.Threading;

namespace InsaneGenius.Utilities;

Expand Down
2 changes: 1 addition & 1 deletion Utilities/Format.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace InsaneGenius.Utilities;

Expand Down
2 changes: 1 addition & 1 deletion Utilities/Iso6392.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion Utilities/Iso6393.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion Utilities/LogOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// TODO: Problematic when used in different environments
// TODO: Problematic when used in different environments
// using Microsoft.Extensions.Logging;

using Serilog;
Expand Down
4 changes: 2 additions & 2 deletions Utilities/ProcessEx.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
Expand All @@ -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<int> ExecuteExAsync(string executable, string parameters)
{
Expand Down
2 changes: 1 addition & 1 deletion Utilities/Rfc5646.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
Expand Down
2 changes: 1 addition & 1 deletion Utilities/StringCompression.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.IO;
using System.IO;
using System.IO.Compression;
using System.Text;

Expand Down
2 changes: 1 addition & 1 deletion Utilities/StringHistory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Text;

namespace InsaneGenius.Utilities;
Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/CommandLineTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Xunit;
using Xunit;

namespace InsaneGenius.Utilities.Tests;

Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/ConsoleTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Xunit;
using Xunit;

namespace InsaneGenius.Utilities.Tests;

Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/DownloadTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Xunit;

namespace InsaneGenius.Utilities.Tests;
Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/FileTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
using Xunit;

namespace InsaneGenius.Utilities.Tests;
Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/FormatTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Xunit;
using Xunit;

namespace InsaneGenius.Utilities.Tests;

Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/Iso6392Tests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.IO;
using System.IO;
using System.Reflection;
using Xunit;

Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/Iso6393Tests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.IO;
using System.IO;
using System.Reflection;
using Xunit;

Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/Rfc5646Tests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Reflection;
using Xunit;
Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/StringCompressionTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Xunit;

namespace InsaneGenius.Utilities.Tests;
Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/UtilitiesTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace InsaneGenius.Utilities.Tests;

Expand Down
2 changes: 1 addition & 1 deletion UtilitiesTests/UtilitiesTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PackageReference Include="Serilog" Version="4.2.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.analyzers" Version="1.21.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" PrivateAssets="All" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Utilities\Utilities.csproj" />
Expand Down