This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
78 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>3.1.1</Version> | ||
<Version>3.2.0</Version> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
// \__ \\__ \| __/| | | || (_| || (_| || | | | | ||
// |___/|___/ \___||_| |_| \__,_| \__,_||_| |_| | ||
// | | ||
// Copyright 2021-2021 Łukasz "JustArchi" Domeradzki | ||
// Copyright 2021-2022 Łukasz "JustArchi" Domeradzki | ||
// Contact: [email protected] | ||
// | | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
@@ -20,48 +20,21 @@ | |
// limitations under the License. | ||
|
||
#if !NETSTANDARD2_1_OR_GREATER | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Net.WebSockets; | ||
using System.Threading; | ||
using JustArchiNET.Madness.Internal; | ||
#endif | ||
using System; | ||
using System.IO; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using JetBrains.Annotations; | ||
using JustArchiNET.Madness.Helpers; | ||
using Microsoft.AspNetCore.Hosting; | ||
using JustArchiNET.Madness.Internal; | ||
|
||
namespace JustArchiNET.Madness; | ||
|
||
[MadnessType(EMadnessType.Extension)] | ||
[PublicAPI] | ||
public static class StaticExtensions { | ||
[MadnessType(EMadnessType.Implementation)] | ||
public static StringBuilder Append(this StringBuilder stringBuilder, IFormatProvider? provider, string text) { | ||
if (stringBuilder == null) { | ||
throw new ArgumentNullException(nameof(stringBuilder)); | ||
} | ||
|
||
if (text == null) { | ||
throw new ArgumentNullException(nameof(text)); | ||
} | ||
|
||
return stringBuilder.Append(text.ToString(provider)); | ||
} | ||
|
||
[MadnessType(EMadnessType.Implementation)] | ||
public static Task<byte[]> ComputeHashAsync(this HashAlgorithm hashAlgorithm, Stream inputStream) { | ||
if (hashAlgorithm == null) { | ||
throw new ArgumentNullException(nameof(hashAlgorithm)); | ||
} | ||
|
||
return Task.FromResult(hashAlgorithm.ComputeHash(inputStream)); | ||
} | ||
|
||
#if !NETSTANDARD2_1_OR_GREATER | ||
public static class StaticExtensions20 { | ||
[MadnessType(EMadnessType.Implementation)] | ||
public static IAsyncDisposable ConfigureAwait(this IDisposable source, bool continueOnCapturedContext) { | ||
if (source == null) { | ||
|
@@ -70,20 +43,7 @@ public static IAsyncDisposable ConfigureAwait(this IDisposable source, bool cont | |
|
||
return new AsyncDisposableWrapper(source, continueOnCapturedContext); | ||
} | ||
#endif | ||
|
||
[MadnessType(EMadnessType.Implementation)] | ||
public static IWebHostBuilder ConfigureWebHostDefaults(this IWebHostBuilder builder, Action<IWebHostBuilder> configure) { | ||
if (configure == null) { | ||
throw new ArgumentNullException(nameof(configure)); | ||
} | ||
|
||
configure(builder); | ||
|
||
return builder; | ||
} | ||
|
||
#if !NETSTANDARD2_1_OR_GREATER | ||
[MadnessType(EMadnessType.Implementation)] | ||
public static bool Contains(this string input, char value) { | ||
if (input == null) { | ||
|
@@ -240,5 +200,5 @@ private static ValueTask FakeDisposeAsync(IDisposable? disposable) { | |
|
||
return default(ValueTask); | ||
} | ||
#endif | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// _ __ __ | ||
// ___ ___ ___ _ __ __| | __ _ | \/ | | ||
// / __|/ __| / _ \| '_ \ / _` | / _` || |\/| | | ||
// \__ \\__ \| __/| | | || (_| || (_| || | | | | ||
// |___/|___/ \___||_| |_| \__,_| \__,_||_| |_| | ||
// | | ||
// Copyright 2021-2022 Łukasz "JustArchi" Domeradzki | ||
// Contact: [email protected] | ||
// | | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System; | ||
using System.IO; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using JetBrains.Annotations; | ||
using JustArchiNET.Madness.Helpers; | ||
using Microsoft.AspNetCore.Hosting; | ||
|
||
namespace JustArchiNET.Madness; | ||
|
||
[MadnessType(EMadnessType.Extension)] | ||
[PublicAPI] | ||
public static class StaticExtensions21 { | ||
[MadnessType(EMadnessType.Implementation)] | ||
public static StringBuilder Append(this StringBuilder stringBuilder, IFormatProvider? provider, string text) { | ||
if (stringBuilder == null) { | ||
throw new ArgumentNullException(nameof(stringBuilder)); | ||
} | ||
|
||
if (text == null) { | ||
throw new ArgumentNullException(nameof(text)); | ||
} | ||
|
||
return stringBuilder.Append(text.ToString(provider)); | ||
} | ||
|
||
[MadnessType(EMadnessType.Implementation)] | ||
public static Task<byte[]> ComputeHashAsync(this HashAlgorithm hashAlgorithm, Stream inputStream) { | ||
if (hashAlgorithm == null) { | ||
throw new ArgumentNullException(nameof(hashAlgorithm)); | ||
} | ||
|
||
return Task.FromResult(hashAlgorithm.ComputeHash(inputStream)); | ||
} | ||
|
||
[MadnessType(EMadnessType.Implementation)] | ||
public static IWebHostBuilder ConfigureWebHostDefaults(this IWebHostBuilder builder, Action<IWebHostBuilder> configure) { | ||
if (configure == null) { | ||
throw new ArgumentNullException(nameof(configure)); | ||
} | ||
|
||
configure(builder); | ||
|
||
return builder; | ||
} | ||
|
||
[MadnessType(EMadnessType.Implementation)] | ||
public static bool IsDefined<TEnum>(TEnum value) where TEnum : struct, Enum => Enum.IsDefined(value.GetType(), value); | ||
} |