mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 14:46:26 +00:00
Updated to .net 6.0 and remove .net-standard2.0 support
This commit is contained in:
parent
adbf7eb99f
commit
5cebb910f7
12
.github/workflows/cicd.yaml
vendored
12
.github/workflows/cicd.yaml
vendored
@ -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 }}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0;net5.0;netstandard2.1</TargetFrameworks>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<PackageId>SpotifyAPI.Web.Auth</PackageId>
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<UserSecretsId>da29eac4-4c22-4a7f-b393-379e83b60998</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNet.Security.OAuth.Spotify" Version="5.0.18" />
|
||||
<PackageReference Include="AspNet.Security.OAuth.Spotify" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SpotifyAPI.Web\SpotifyAPI.Web.csproj" />
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,13 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.10" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -6,7 +6,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
@ -6,7 +6,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.2</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
@ -39,7 +39,6 @@ namespace SpotifyAPI.Web
|
||||
IAPIConnector connector
|
||||
);
|
||||
|
||||
#if !NETSTANDARD2_0
|
||||
/// <summary>
|
||||
/// Fetches all pages and returns one by one using IAsyncEnumerable
|
||||
/// </summary>
|
||||
@ -69,6 +68,5 @@ namespace SpotifyAPI.Web
|
||||
IAPIConnector connector,
|
||||
CancellationToken cancel = default
|
||||
);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,6 @@ namespace SpotifyAPI.Web
|
||||
IPaginator? paginator = default!
|
||||
);
|
||||
|
||||
#if !NETSTANDARD2_0
|
||||
/// <summary>
|
||||
/// 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<Paging<T>> NextPage<T>(Paging<T> paging);
|
||||
|
||||
public Task<CursorPaging<T>> NextPage<T>(CursorPaging<T> cursorPaging);
|
||||
|
@ -68,7 +68,6 @@ namespace SpotifyAPI.Web
|
||||
return results;
|
||||
}
|
||||
|
||||
#if !NETSTANDARD2_0
|
||||
public async IAsyncEnumerable<T> Paginate<T>(
|
||||
IPaginatable<T> firstPage,
|
||||
IAPIConnector connector,
|
||||
@ -125,6 +124,5 @@ namespace SpotifyAPI.Web
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,6 @@ namespace SpotifyAPI.Web
|
||||
return FetchPage<TNext>(paging.Previous);
|
||||
}
|
||||
|
||||
#if !NETSTANDARD2_0
|
||||
|
||||
/// <summary>
|
||||
/// Paginate through pages by using IAsyncEnumerable, introduced in C# 8
|
||||
@ -298,6 +297,5 @@ namespace SpotifyAPI.Web
|
||||
yield return item;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0;net5.0;netstandard2.1</TargetFrameworks>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<PackageId>SpotifyAPI.Web</PackageId>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user