diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 6d57c78a..4dbc169c 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -15,10 +15,10 @@ jobs: dotnet-version: "3.1.x" - uses: actions/setup-dotnet@v1 with: - dotnet-version: "2.2.x" + dotnet-version: "5.0.x" - uses: actions/setup-dotnet@v1 with: - dotnet-version: "5.0.x" + dotnet-version: "6.0.x" - name: Set RELEASE_VERSION run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Restore Packages @@ -47,21 +47,21 @@ jobs: - name: Upload to GH Release if: startsWith( github.ref, 'refs/tags/') run: | - zip -j SpotifyAPI.Web-netstandard2.0.zip SpotifyAPI.Web/bin/Release/netstandard2.0/* zip -j SpotifyAPI.Web-netstandard2.1.zip SpotifyAPI.Web/bin/Release/netstandard2.1/* zip -j SpotifyAPI.Web-net5.0.zip SpotifyAPI.Web/bin/Release/net5.0/* + zip -j SpotifyAPI.Web-net6.0.zip SpotifyAPI.Web/bin/Release/net6.0/* - zip -j SpotifyAPI.Web.Auth-netstandard2.0.zip SpotifyAPI.Web.Auth/bin/Release/netstandard2.0/* zip -j SpotifyAPI.Web.Auth-netstandard2.1.zip SpotifyAPI.Web.Auth/bin/Release/netstandard2.1/* zip -j SpotifyAPI.Web.Auth-net5.0.zip SpotifyAPI.Web.Auth/bin/Release/net5.0/* + zip -j SpotifyAPI.Web.Auth-net6.0.zip SpotifyAPI.Web.Auth/bin/Release/net6.0/* hub release edit \ - -a "SpotifyAPI.Web-netstandard2.0.zip" \ -a "SpotifyAPI.Web-netstandard2.1.zip" \ -a "SpotifyAPI.Web-net5.0.zip" \ - -a "SpotifyAPI.Web.Auth-netstandard2.0.zip" \ + -a "SpotifyAPI.Web-net6.0.zip" \ -a "SpotifyAPI.Web.Auth-netstandard2.1.zip" \ -a "SpotifyAPI.Web.Auth-net5.0.zip" \ + -a "SpotifyAPI.Web.Auth-net6.0.zip" \ -m "" "$RELEASE_VERSION" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/SpotifyAPI.Web.Auth/SpotifyAPI.Web.Auth.csproj b/SpotifyAPI.Web.Auth/SpotifyAPI.Web.Auth.csproj index 8400de7c..1593a285 100644 --- a/SpotifyAPI.Web.Auth/SpotifyAPI.Web.Auth.csproj +++ b/SpotifyAPI.Web.Auth/SpotifyAPI.Web.Auth.csproj @@ -1,6 +1,6 @@  - net5.0;netstandard2.1;netstandard2.0 + net6.0;net5.0;netstandard2.1 9.0 enable SpotifyAPI.Web.Auth diff --git a/SpotifyAPI.Web.Examples/Example.ASP/Example.ASP.csproj b/SpotifyAPI.Web.Examples/Example.ASP/Example.ASP.csproj index 4d8aca5a..ad530266 100644 --- a/SpotifyAPI.Web.Examples/Example.ASP/Example.ASP.csproj +++ b/SpotifyAPI.Web.Examples/Example.ASP/Example.ASP.csproj @@ -1,11 +1,11 @@  - net5.0 + net6.0 da29eac4-4c22-4a7f-b393-379e83b60998 - + diff --git a/SpotifyAPI.Web.Examples/Example.ASPBlazor/Example.ASPBlazor.csproj b/SpotifyAPI.Web.Examples/Example.ASPBlazor/Example.ASPBlazor.csproj index 4ec3d7a1..dd106003 100644 --- a/SpotifyAPI.Web.Examples/Example.ASPBlazor/Example.ASPBlazor.csproj +++ b/SpotifyAPI.Web.Examples/Example.ASPBlazor/Example.ASPBlazor.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 diff --git a/SpotifyAPI.Web.Examples/Example.BlazorWASM/Example.BlazorWASM.csproj b/SpotifyAPI.Web.Examples/Example.BlazorWASM/Example.BlazorWASM.csproj index 412b15bd..b61a066e 100644 --- a/SpotifyAPI.Web.Examples/Example.BlazorWASM/Example.BlazorWASM.csproj +++ b/SpotifyAPI.Web.Examples/Example.BlazorWASM/Example.BlazorWASM.csproj @@ -1,13 +1,13 @@ - net5.0 + net6.0 - + - + diff --git a/SpotifyAPI.Web.Examples/Example.CLI.CustomHTML/Example.CLI.CustomHTML.csproj b/SpotifyAPI.Web.Examples/Example.CLI.CustomHTML/Example.CLI.CustomHTML.csproj index 12043086..bc13fef9 100644 --- a/SpotifyAPI.Web.Examples/Example.CLI.CustomHTML/Example.CLI.CustomHTML.csproj +++ b/SpotifyAPI.Web.Examples/Example.CLI.CustomHTML/Example.CLI.CustomHTML.csproj @@ -6,7 +6,7 @@ - net5.0 + net6.0 Exe diff --git a/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Example.CLI.PersistentConfig.csproj b/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Example.CLI.PersistentConfig.csproj index 16d94d89..381b9d51 100644 --- a/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Example.CLI.PersistentConfig.csproj +++ b/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Example.CLI.PersistentConfig.csproj @@ -2,7 +2,7 @@ Exe - net5.0 + net6.0 8.0 enable diff --git a/SpotifyAPI.Web.Examples/Example.TokenSwap/Client/Client.csproj b/SpotifyAPI.Web.Examples/Example.TokenSwap/Client/Client.csproj index e57fedf9..22ac6759 100644 --- a/SpotifyAPI.Web.Examples/Example.TokenSwap/Client/Client.csproj +++ b/SpotifyAPI.Web.Examples/Example.TokenSwap/Client/Client.csproj @@ -6,7 +6,7 @@ - net5.0 + net6.0 Exe diff --git a/SpotifyAPI.Web.Tests/SpotifyAPI.Web.Tests.csproj b/SpotifyAPI.Web.Tests/SpotifyAPI.Web.Tests.csproj index f7a29281..b294e8a2 100644 --- a/SpotifyAPI.Web.Tests/SpotifyAPI.Web.Tests.csproj +++ b/SpotifyAPI.Web.Tests/SpotifyAPI.Web.Tests.csproj @@ -1,7 +1,7 @@  - net5.0;netcoreapp3.1;netcoreapp2.2 + net6.0;net5.0;netcoreapp3.1 9.0 false diff --git a/SpotifyAPI.Web/Clients/Interfaces/IPaginator.cs b/SpotifyAPI.Web/Clients/Interfaces/IPaginator.cs index 7ca0fa12..8317ca28 100644 --- a/SpotifyAPI.Web/Clients/Interfaces/IPaginator.cs +++ b/SpotifyAPI.Web/Clients/Interfaces/IPaginator.cs @@ -39,7 +39,6 @@ namespace SpotifyAPI.Web IAPIConnector connector ); -#if !NETSTANDARD2_0 /// /// Fetches all pages and returns one by one using IAsyncEnumerable /// @@ -69,6 +68,5 @@ namespace SpotifyAPI.Web IAPIConnector connector, CancellationToken cancel = default ); -#endif } } diff --git a/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs b/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs index dfa7227f..9cbaf8b9 100644 --- a/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs +++ b/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs @@ -128,7 +128,6 @@ namespace SpotifyAPI.Web IPaginator? paginator = default! ); -#if !NETSTANDARD2_0 /// /// Paginate through pages by using IAsyncEnumerable, introduced in C# 8 /// The default paginator will fetch all available resources without a delay between requests. @@ -166,8 +165,6 @@ namespace SpotifyAPI.Web CancellationToken cancellationToken = default! ); -#endif - public Task> NextPage(Paging paging); public Task> NextPage(CursorPaging cursorPaging); diff --git a/SpotifyAPI.Web/Clients/SimplePaginator.cs b/SpotifyAPI.Web/Clients/SimplePaginator.cs index 76edf8d1..dfff378e 100644 --- a/SpotifyAPI.Web/Clients/SimplePaginator.cs +++ b/SpotifyAPI.Web/Clients/SimplePaginator.cs @@ -68,7 +68,6 @@ namespace SpotifyAPI.Web return results; } -#if !NETSTANDARD2_0 public async IAsyncEnumerable Paginate( IPaginatable firstPage, IAPIConnector connector, @@ -125,6 +124,5 @@ namespace SpotifyAPI.Web } } } -#endif } } diff --git a/SpotifyAPI.Web/Clients/SpotifyClient.cs b/SpotifyAPI.Web/Clients/SpotifyClient.cs index 92f77107..41bb6e23 100644 --- a/SpotifyAPI.Web/Clients/SpotifyClient.cs +++ b/SpotifyAPI.Web/Clients/SpotifyClient.cs @@ -190,7 +190,6 @@ namespace SpotifyAPI.Web return FetchPage(paging.Previous); } -#if !NETSTANDARD2_0 /// /// Paginate through pages by using IAsyncEnumerable, introduced in C# 8 @@ -298,6 +297,5 @@ namespace SpotifyAPI.Web yield return item; } } -#endif } } diff --git a/SpotifyAPI.Web/Http/APIConnector.cs b/SpotifyAPI.Web/Http/APIConnector.cs index 21961811..c6945201 100644 --- a/SpotifyAPI.Web/Http/APIConnector.cs +++ b/SpotifyAPI.Web/Http/APIConnector.cs @@ -218,15 +218,9 @@ namespace SpotifyAPI.Web.Http private async Task ApplyAuthenticator(IRequest request) { -#if NETSTANDARD2_0 - if (_authenticator != null - && !request.Endpoint.IsAbsoluteUri - || request.Endpoint.AbsoluteUri.Contains("https://api.spotify.com")) -#else if (_authenticator != null && !request.Endpoint.IsAbsoluteUri || request.Endpoint.AbsoluteUri.Contains("https://api.spotify.com", StringComparison.InvariantCulture)) -#endif { await _authenticator!.Apply(request, this).ConfigureAwait(false); } diff --git a/SpotifyAPI.Web/Http/SimpleConsoleHTTPLogger.cs b/SpotifyAPI.Web/Http/SimpleConsoleHTTPLogger.cs index 6049e17e..f401c6bc 100644 --- a/SpotifyAPI.Web/Http/SimpleConsoleHTTPLogger.cs +++ b/SpotifyAPI.Web/Http/SimpleConsoleHTTPLogger.cs @@ -27,11 +27,7 @@ namespace SpotifyAPI.Web.Http public void OnResponse(IResponse response) { Ensure.ArgumentNotNull(response, nameof(response)); -#if NETSTANDARD2_0 - string? body = response.Body?.ToString().Replace("\n", ""); -#else string? body = response.Body?.ToString()?.Replace("\n", "", StringComparison.InvariantCulture); -#endif body = body?.Substring(0, Math.Min(50, body.Length)); Console.WriteLine("--> {0} {1} {2}\n", response.StatusCode, response.ContentType, body); diff --git a/SpotifyAPI.Web/SpotifyAPI.Web.csproj b/SpotifyAPI.Web/SpotifyAPI.Web.csproj index 147d2ac2..81f8d647 100644 --- a/SpotifyAPI.Web/SpotifyAPI.Web.csproj +++ b/SpotifyAPI.Web/SpotifyAPI.Web.csproj @@ -1,7 +1,7 @@  - net5.0;netstandard2.1;netstandard2.0 + net6.0;net5.0;netstandard2.1 9.0 enable SpotifyAPI.Web diff --git a/SpotifyAPI.Web/Util/PKCEUtil.cs b/SpotifyAPI.Web/Util/PKCEUtil.cs index 55157a8d..14900ec9 100644 --- a/SpotifyAPI.Web/Util/PKCEUtil.cs +++ b/SpotifyAPI.Web/Util/PKCEUtil.cs @@ -52,11 +52,12 @@ namespace SpotifyAPI.Web private static string GenerateRandomURLSafeString(int length) { - using var rng = new RNGCryptoServiceProvider(); var bit_count = length * 6; var byte_count = (bit_count + 7) / 8; // rounded up var bytes = new byte[byte_count]; - rng.GetBytes(bytes); + + using var generator = RandomNumberGenerator.Create(); + generator.GetBytes(bytes); return Base64Util.UrlEncode(bytes); } diff --git a/SpotifyAPI.Web/Util/StringAttribute.cs b/SpotifyAPI.Web/Util/StringAttribute.cs index bc13301a..2d1cf372 100644 --- a/SpotifyAPI.Web/Util/StringAttribute.cs +++ b/SpotifyAPI.Web/Util/StringAttribute.cs @@ -15,11 +15,7 @@ namespace SpotifyAPI.Web public string Value { get; } -#if NETSTANDARD2_0 - public static bool GetValue(Type enumType, Enum enumValue, out string? result) -#else public static bool GetValue(Type enumType, Enum enumValue, [NotNullWhen(true)] out string? result) -#endif { Ensure.ArgumentNotNull(enumType, nameof(enumType)); Ensure.ArgumentNotNull(enumValue, nameof(enumValue));