mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2025-01-10 21:57:46 +00:00
add .net8 support
This commit is contained in:
parent
78cc5a78da
commit
2bff224ef1
9
.github/workflows/cicd.yaml
vendored
9
.github/workflows/cicd.yaml
vendored
@ -18,7 +18,10 @@ jobs:
|
|||||||
dotnet-version: "6.x"
|
dotnet-version: "6.x"
|
||||||
- uses: actions/setup-dotnet@v3
|
- uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: "7.0.203"
|
dotnet-version: "7.x"
|
||||||
|
- uses: actions/setup-dotnet@v3
|
||||||
|
with:
|
||||||
|
dotnet-version: "8.x"
|
||||||
- name: Set RELEASE_VERSION
|
- name: Set RELEASE_VERSION
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||||
- name: Restore Packages
|
- name: Restore Packages
|
||||||
@ -54,12 +57,14 @@ jobs:
|
|||||||
zip -j SpotifyAPI.Web-net5.0.zip SpotifyAPI.Web/bin/Release/net5.0/*
|
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-net6.0.zip SpotifyAPI.Web/bin/Release/net6.0/*
|
||||||
zip -j SpotifyAPI.Web-net7.0.zip SpotifyAPI.Web/bin/Release/net7.0/*
|
zip -j SpotifyAPI.Web-net7.0.zip SpotifyAPI.Web/bin/Release/net7.0/*
|
||||||
|
zip -j SpotifyAPI.Web-net8.0.zip SpotifyAPI.Web/bin/Release/net8.0/*
|
||||||
|
|
||||||
zip -j SpotifyAPI.Web.Auth-netstandard2.0.zip SpotifyAPI.Web.Auth/bin/Release/netstandard2.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-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-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/*
|
zip -j SpotifyAPI.Web.Auth-net6.0.zip SpotifyAPI.Web.Auth/bin/Release/net6.0/*
|
||||||
zip -j SpotifyAPI.Web.Auth-net7.0.zip SpotifyAPI.Web.Auth/bin/Release/net7.0/*
|
zip -j SpotifyAPI.Web.Auth-net7.0.zip SpotifyAPI.Web.Auth/bin/Release/net7.0/*
|
||||||
|
zip -j SpotifyAPI.Web.Auth-net8.0.zip SpotifyAPI.Web.Auth/bin/Release/net8.0/*
|
||||||
|
|
||||||
gh release upload "$RELEASE_VERSION" \
|
gh release upload "$RELEASE_VERSION" \
|
||||||
"SpotifyAPI.Web-netstandard2.0.zip" \
|
"SpotifyAPI.Web-netstandard2.0.zip" \
|
||||||
@ -67,10 +72,12 @@ jobs:
|
|||||||
"SpotifyAPI.Web-net5.0.zip" \
|
"SpotifyAPI.Web-net5.0.zip" \
|
||||||
"SpotifyAPI.Web-net6.0.zip" \
|
"SpotifyAPI.Web-net6.0.zip" \
|
||||||
"SpotifyAPI.Web-net7.0.zip" \
|
"SpotifyAPI.Web-net7.0.zip" \
|
||||||
|
"SpotifyAPI.Web-net8.0.zip" \
|
||||||
"SpotifyAPI.Web.Auth-netstandard2.0.zip" \
|
"SpotifyAPI.Web.Auth-netstandard2.0.zip" \
|
||||||
"SpotifyAPI.Web.Auth-netstandard2.1.zip" \
|
"SpotifyAPI.Web.Auth-netstandard2.1.zip" \
|
||||||
"SpotifyAPI.Web.Auth-net5.0.zip" \
|
"SpotifyAPI.Web.Auth-net5.0.zip" \
|
||||||
"SpotifyAPI.Web.Auth-net6.0.zip" \
|
"SpotifyAPI.Web.Auth-net6.0.zip" \
|
||||||
"SpotifyAPI.Web.Auth-net7.0.zip"
|
"SpotifyAPI.Web.Auth-net7.0.zip"
|
||||||
|
"SpotifyAPI.Web.Auth-net8.0.zip"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
|
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>SpotifyAPI.Web.Auth</PackageId>
|
<PackageId>SpotifyAPI.Web.Auth</PackageId>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||||
|
@ -30,6 +30,9 @@ namespace SpotifyAPI.Web
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if NET8_0_OR_GREATER
|
||||||
|
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")]
|
||||||
|
#endif
|
||||||
protected APIException(SerializationInfo info, StreamingContext context) : base(info, context)
|
protected APIException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||||
{
|
{
|
||||||
Response = info.GetValue("APIException.Response", typeof(IResponse)) as IResponse;
|
Response = info.GetValue("APIException.Response", typeof(IResponse)) as IResponse;
|
||||||
@ -67,6 +70,11 @@ namespace SpotifyAPI.Web
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if NET8_0_OR_GREATER
|
||||||
|
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")]
|
||||||
|
#endif
|
||||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||||
{
|
{
|
||||||
base.GetObjectData(info, context);
|
base.GetObjectData(info, context);
|
||||||
|
@ -26,6 +26,9 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public APIPagingException(string message, Exception innerException) : base(message, innerException) { }
|
public APIPagingException(string message, Exception innerException) : base(message, innerException) { }
|
||||||
|
|
||||||
|
#if NET8_0_OR_GREATER
|
||||||
|
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")]
|
||||||
|
#endif
|
||||||
protected APIPagingException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
protected APIPagingException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,9 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public APITooManyRequestsException(string message, Exception innerException) : base(message, innerException) { }
|
public APITooManyRequestsException(string message, Exception innerException) : base(message, innerException) { }
|
||||||
|
|
||||||
|
#if NET8_0_OR_GREATER
|
||||||
|
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")]
|
||||||
|
#endif
|
||||||
protected APITooManyRequestsException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
protected APITooManyRequestsException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,9 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public APIUnauthorizedException(string message, Exception innerException) : base(message, innerException) { }
|
public APIUnauthorizedException(string message, Exception innerException) : base(message, innerException) { }
|
||||||
|
|
||||||
|
#if NET8_0_OR_GREATER
|
||||||
|
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")]
|
||||||
|
#endif
|
||||||
protected APIUnauthorizedException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
protected APIUnauthorizedException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ namespace SpotifyAPI.Web.Http
|
|||||||
_httpClient.SetRequestTimeout(timeout);
|
_httpClient.SetRequestTimeout(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IRequest CreateRequest(
|
private Request CreateRequest(
|
||||||
Uri uri,
|
Uri uri,
|
||||||
HttpMethod method,
|
HttpMethod method,
|
||||||
IDictionary<string, string>? parameters,
|
IDictionary<string, string>? parameters,
|
||||||
|
@ -112,7 +112,7 @@ namespace SpotifyAPI.Web.Http
|
|||||||
_httpClient.Timeout = timeout;
|
_httpClient.Timeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HttpMessageHandler CreateMessageHandler(IProxyConfig proxyConfig)
|
private static HttpClientHandler CreateMessageHandler(IProxyConfig proxyConfig)
|
||||||
{
|
{
|
||||||
var proxy = new WebProxy
|
var proxy = new WebProxy
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
|
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>SpotifyAPI.Web</PackageId>
|
<PackageId>SpotifyAPI.Web</PackageId>
|
||||||
|
@ -1,20 +1,31 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace SpotifyAPI.Web
|
namespace SpotifyAPI.Web
|
||||||
{
|
{
|
||||||
internal class Base64Util
|
internal class Base64Util
|
||||||
{
|
{
|
||||||
internal const string WebEncoders_InvalidCountOffsetOrLength = "Invalid {0}, {1} or {2} length.";
|
internal const string WebEncoders_InvalidCountOffsetOrLength = "Invalid {0}, {1} or {2} length.";
|
||||||
|
|
||||||
|
#if NET8_0_OR_GREATER
|
||||||
|
internal static CompositeFormat WebEncoders_MalformedInput = CompositeFormat.Parse("Malformed input: {0} is an invalid input length.");
|
||||||
|
#else
|
||||||
internal const string WebEncoders_MalformedInput = "Malformed input: {0} is an invalid input length.";
|
internal const string WebEncoders_MalformedInput = "Malformed input: {0} is an invalid input length.";
|
||||||
|
#endif
|
||||||
|
|
||||||
public static string UrlEncode(byte[] input)
|
public static string UrlEncode(byte[] input)
|
||||||
{
|
{
|
||||||
|
#if NET8_0_OR_GREATER
|
||||||
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
#else
|
||||||
if (input == null)
|
if (input == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(input));
|
throw new ArgumentNullException(nameof(input));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Special-case empty input
|
// Special-case empty input
|
||||||
if (input.Length == 0)
|
if (input.Length == 0)
|
||||||
@ -48,11 +59,15 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public static byte[] UrlDecode(string input)
|
public static byte[] UrlDecode(string input)
|
||||||
{
|
{
|
||||||
var buffer = new char[GetArraySizeRequiredToDecode(input.Length)];
|
#if NET8_0_OR_GREATER
|
||||||
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
#else
|
||||||
if (input == null)
|
if (input == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(input));
|
throw new ArgumentNullException(nameof(input));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
var buffer = new char[GetArraySizeRequiredToDecode(input.Length)];
|
||||||
|
|
||||||
// Assumption: input is base64url encoded without padding and contains no whitespace.
|
// Assumption: input is base64url encoded without padding and contains no whitespace.
|
||||||
|
|
||||||
@ -97,10 +112,14 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
private static int GetArraySizeRequiredToDecode(int count)
|
private static int GetArraySizeRequiredToDecode(int count)
|
||||||
{
|
{
|
||||||
|
#if NET8_0_OR_GREATER
|
||||||
|
ArgumentOutOfRangeException.ThrowIfNegative(count);
|
||||||
|
#else
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException(nameof(count));
|
throw new ArgumentOutOfRangeException(nameof(count));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user