diff --git a/.github/workflows/check-buildstatus.yml b/.github/workflows/check-buildstatus.yml index 53b7713f..ba82d7de 100644 --- a/.github/workflows/check-buildstatus.yml +++ b/.github/workflows/check-buildstatus.yml @@ -14,7 +14,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore - name: Build TwitchLib.Client diff --git a/.github/workflows/preview-release.yml b/.github/workflows/preview-release.yml index b55ea1e4..b3f18367 100644 --- a/.github/workflows/preview-release.yml +++ b/.github/workflows/preview-release.yml @@ -14,7 +14,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore - name: Build TwitchLib.Client diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c8790114..df13f090 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore - name: Build TwitchLib.Client diff --git a/TwitchLib.Client.Benchmark/TwitchLib.Client.Benchmark.csproj b/TwitchLib.Client.Benchmark/TwitchLib.Client.Benchmark.csproj index 9415bf21..d5110b65 100644 --- a/TwitchLib.Client.Benchmark/TwitchLib.Client.Benchmark.csproj +++ b/TwitchLib.Client.Benchmark/TwitchLib.Client.Benchmark.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 false enable enable @@ -10,7 +10,7 @@ - + diff --git a/TwitchLib.Client.Models/MessageEmote.cs b/TwitchLib.Client.Models/MessageEmote.cs index 1116ce5b..73e458b2 100644 --- a/TwitchLib.Client.Models/MessageEmote.cs +++ b/TwitchLib.Client.Models/MessageEmote.cs @@ -1,4 +1,5 @@ using System.Collections.ObjectModel; +using System.Text; using System.Text.RegularExpressions; // TODO: Missing builder @@ -234,7 +235,11 @@ public MessageEmote( public class MessageEmoteCollection { private readonly Dictionary _emotes; +#if NET8_0_OR_GREATER + private static readonly CompositeFormat BasePattern = CompositeFormat.Parse(@"(\b {0}\b)|(\b{0} \b)|(?<=\W){0}(?=$)|(?<=\s){0}(?=\s)|(^{0}$)"); +#else private const string BasePattern = @"(\b {0}\b)|(\b{0} \b)|(?<=\W){0}(?=$)|(?<=\s){0}(?=\s)|(^{0}$)"; +#endif /// Do not access directly! Backing field for private string? _currentPattern; @@ -321,11 +326,11 @@ public void Add(MessageEmote emote) if (CurrentPattern == null) { //string i = String.Format(_basePattern, "(" + emote.EscapedText + "){0}"); - CurrentPattern = string.Format(BasePattern, emote.EscapedText); + CurrentPattern = string.Format(null, BasePattern, emote.EscapedText); } else { - CurrentPattern = CurrentPattern + "|" + string.Format(BasePattern, emote.EscapedText); + CurrentPattern = CurrentPattern + "|" + string.Format(null, BasePattern, emote.EscapedText); } } diff --git a/TwitchLib.Client.Models/TwitchLib.Client.Models.csproj b/TwitchLib.Client.Models/TwitchLib.Client.Models.csproj index 00d43f47..e1e28773 100644 --- a/TwitchLib.Client.Models/TwitchLib.Client.Models.csproj +++ b/TwitchLib.Client.Models/TwitchLib.Client.Models.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netstandard2.1;net6.0;net7.0 + netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0 enable enable latest diff --git a/TwitchLib.Client.Test/MyAssert.cs b/TwitchLib.Client.Test/MyAssert.cs index 11ebded4..2c48b6b9 100644 --- a/TwitchLib.Client.Test/MyAssert.cs +++ b/TwitchLib.Client.Test/MyAssert.cs @@ -21,12 +21,12 @@ public partial class MyAssert public static async Task> RaisesAsync(Action> attach, Action> detach, Func testCode) { var raisedEvent = await RaisesAsyncInternal(attach, detach, testCode); - + if (raisedEvent == null) - throw new RaisesException(typeof(T)); + throw RaisesException.ForNoEvent(typeof(T)); if (raisedEvent.Arguments != null && !raisedEvent.Arguments.GetType().Equals(typeof(T))) - throw new RaisesException(typeof(T), raisedEvent.Arguments.GetType()); + throw RaisesException.ForIncorrectType(typeof(T), raisedEvent.Arguments.GetType()); return raisedEvent; } @@ -45,7 +45,7 @@ public static async Task> RaisesAnyAsync(Action - net7.0 + net8.0 false enable - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TwitchLib.Client/Extensions/LogExtensions.cs b/TwitchLib.Client/Extensions/LogExtensions.cs index eeb559d8..ceaea673 100644 --- a/TwitchLib.Client/Extensions/LogExtensions.cs +++ b/TwitchLib.Client/Extensions/LogExtensions.cs @@ -1,47 +1,45 @@ -#pragma warning disable SYSLIB1006 // Multiple logging methods cannot use the same event id within a class -using System; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; namespace TwitchLib.Client.Extensions; internal static partial class LogExtensions { - [LoggerMessage(0, LogLevel.Information, "Connecting Twitch Chat Client...")] + [LoggerMessage(LogLevel.Information, "Connecting Twitch Chat Client...")] public static partial void LogConnecting(this ILogger logger); - [LoggerMessage(0, LogLevel.Information, "Disconnecting Twitch Chat Client...")] + [LoggerMessage(LogLevel.Information, "Disconnecting Twitch Chat Client...")] public static partial void LogDisconnecting(this ILogger logger); - [LoggerMessage(0, LogLevel.Information, "TwitchLib-TwitchClient initialized, assembly version: {version}")] + [LoggerMessage(LogLevel.Information, "TwitchLib-TwitchClient initialized, assembly version: {version}")] public static partial void LogInitialized(this ILogger logger, Version version); - [LoggerMessage(0, LogLevel.Information, "Joining channel: {channel}")] + [LoggerMessage(LogLevel.Information, "Joining channel: {channel}")] public static partial void LogJoiningChannel(this ILogger logger, string channel); - [LoggerMessage(0, LogLevel.Debug, "Finished channel joining queue.")] + [LoggerMessage(LogLevel.Debug, "Finished channel joining queue.")] public static partial void LogChannelJoiningFinished(this ILogger logger); - [LoggerMessage(0, LogLevel.Information, "Leaving channel: {channel}")] + [LoggerMessage(LogLevel.Information, "Leaving channel: {channel}")] public static partial void LogLeavingChannel(this ILogger logger, string channel); - [LoggerMessage(0, LogLevel.Error, "Message length has exceeded the maximum character count. (500)")] + [LoggerMessage(LogLevel.Error, "Message length has exceeded the maximum character count. (500)")] public static partial void LogMessageTooLong(this ILogger logger); - [LoggerMessage(0, LogLevel.Trace, "Received: {line}")] + [LoggerMessage(LogLevel.Trace, "Received: {line}")] public static partial void LogReceived(this ILogger logger, string line); - [LoggerMessage(0, LogLevel.Information, "Reconnecting to Twitch")] + [LoggerMessage(LogLevel.Information, "Reconnecting to Twitch")] public static partial void LogReconnecting(this ILogger logger); - [LoggerMessage(0, LogLevel.Debug, "Should be connected!")] + [LoggerMessage(LogLevel.Debug, "Should be connected!")] public static partial void LogShouldBeConnected(this ILogger logger); - [LoggerMessage(0, LogLevel.Warning, "Unaccounted for: {ircString} (please create a TwitchLib GitHub issue :P)")] + [LoggerMessage(LogLevel.Warning, "Unaccounted for: {ircString} (please create a TwitchLib GitHub issue :P)")] public static partial void LogUnaccountedFor(this ILogger logger, string ircString); - [LoggerMessage(0, LogLevel.Debug, "Writing: {message}")] + [LoggerMessage(LogLevel.Debug, "Writing: {message}")] public static partial void LogWriting(this ILogger logger, string message); - [LoggerMessage(0, LogLevel.Error, "{message}")] + [LoggerMessage(LogLevel.Error, "{message}")] public static partial void LogException(this ILogger logger, string message, Exception ex); } diff --git a/TwitchLib.Client/TwitchLib.Client.csproj b/TwitchLib.Client/TwitchLib.Client.csproj index 376eb2c5..4602a963 100644 --- a/TwitchLib.Client/TwitchLib.Client.csproj +++ b/TwitchLib.Client/TwitchLib.Client.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netstandard2.1;net6.0;net7.0 + netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0 enable strict enable @@ -27,7 +27,7 @@ - +