diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 8e350994..c229ac36 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,16 +3,18 @@ "isRoot": true, "tools": { "strawberryshake.tools": { - "version": "13.7.0", + "version": "14.1.0", "commands": [ "dotnet-graphql" - ] + ], + "rollForward": false }, "dotnet-ef": { - "version": "8.0.0", + "version": "9.0.0", "commands": [ "dotnet-ef" - ] + ], + "rollForward": false } } } \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 76eeb9d6..0146626f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,77 +3,88 @@ # # You may wish to alter this file to override the set of languages analyzed, # or to provide custom queries or build logic. -name: "CodeQL" +# + +name: "CodeQL Advanced" on: push: - branches: [vnext] + branches: [ "vnext" ] pull_request: - # The branches below must be a subset of the branches above - branches: [vnext] + branches: [ "vnext" ] schedule: - - cron: '0 19 * * 3' + - cron: '36 10 * * 0' jobs: analyze: - name: Analyze - runs-on: ubuntu-latest + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read strategy: fail-fast: false matrix: - # Override automatic language detection by changing the below list - # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ['csharp'] - # Learn more... - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + include: + - language: csharp + build-mode: manual + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages steps: - - name: Update dotnet - uses: actions/setup-dotnet@v1 - with: - dotnet-version: '8.0.x' + - name: Update dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 8.0.x + 9.0.x - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: dotnet build - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - #- name: Autobuild - # uses: github/codeql-action/autobuild@v1 - - - name: Build - run: dotnet build - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index cbaf7654..a3747cb5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -11,11 +11,13 @@ jobs: runs-on: ubuntu-latest name: "Run Tests" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: update dotnet core sdk - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: | + 8.0.x + 9.0.x - name: dotnet restore (first try) run: dotnet restore --ignore-failed-sources - name: dotnet restore (second try) @@ -31,11 +33,13 @@ jobs: runs-on: ubuntu-latest name: "Build Release" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: update dotnet core sdk - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: | + 8.0.x + 9.0.x - name: dotnet restore (first try) run: dotnet restore --ignore-failed-sources - name: dotnet restore (second try) @@ -62,15 +66,17 @@ jobs: name: "Build Docker image" if: (github.ref == 'refs/heads/master') && (needs.ConfigTest.outputs.docker-username == 'true') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: "clean build artifacts" run: git clean -dfx - name: update dotnet core sdk - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: | + 8.0.x + 9.0.x - name: dotnet restore (first try) run: dotnet restore --ignore-failed-sources - name: dotnet restore (second try) @@ -80,9 +86,9 @@ jobs: - name: dotnet build Release run: dotnet build --no-restore --configuration Release - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -91,7 +97,7 @@ jobs: NUM: ${{ github.run_number }} run: echo "GITHUB_RUN_NUMBER_WITH_OFFSET=$(($NUM+1050))" >> $GITHUB_ENV - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . push: 'true' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 343d7631..598cac5f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,8 +16,3 @@ Recommended development setup See [readme](README.md) for detailed requirement and recommended IDE setup. **Note** that Docker image is currently experimental and wasn't tested in any way. - -IntelliCode Model Link -====================== -You can use [this link](https://prod.intellicode.vsengsaas.visualstudio.com/get?m=7127523297134326920E959DF01AF224) for the pre-trained IntelliCode model based on this project. -In Visual Code 2019.1 or later, you can do this by navigatin `View` → `Other Windows` → `IntelliCode Model Management` → `Add Model`. \ No newline at end of file diff --git a/Clients/CirrusCiClient/CirrusCi.cs b/Clients/CirrusCiClient/CirrusCi.cs index 5db19d60..8a6db0a9 100644 --- a/Clients/CirrusCiClient/CirrusCi.cs +++ b/Clients/CirrusCiClient/CirrusCi.cs @@ -37,27 +37,27 @@ public static class CirrusCi queryResult.EnsureNoErrors(); if (queryResult.Data?.OwnerRepository?.Builds?.Edges is {Count: > 0} edgeList) { - var node = edgeList.LastOrDefault(e => e?.Node?.ChangeIdInRepo == commit)?.Node; + var node = edgeList.LastOrDefault(e => e.Node.ChangeIdInRepo == commit)?.Node; if (node is null) return null; - var winTask = node.Tasks?.FirstOrDefault(t => t?.Name.Contains("Windows") ?? false); - var winArtifact = winTask?.Artifacts? - .Where(a => a?.Files is {Count: >0}) - .SelectMany(a => a!.Files!) - .FirstOrDefault(f => f?.Path.EndsWith(".7z") ?? false); + var winTask = node.Tasks.FirstOrDefault(t => t.Name.Contains("Windows")); + var winArtifact = winTask?.Artifacts + .Where(a => a.Files is {Count: >0}) + .SelectMany(a => a.Files) + .FirstOrDefault(f => f.Path.EndsWith(".7z")); - var linTask = node.Tasks?.FirstOrDefault(t => t is {} lt && lt.Name.Contains("Linux") && lt.Name.Contains("GCC")); - var linArtifact = linTask?.Artifacts? - .Where(a => a?.Files is {Count: >0}) - .SelectMany(a => a!.Files!) - .FirstOrDefault(a => a?.Path.EndsWith(".AppImage") ?? false); + var linTask = node.Tasks.FirstOrDefault(t => t is {} lt && lt.Name.Contains("Linux") && lt.Name.Contains("GCC")); + var linArtifact = linTask?.Artifacts + .Where(a => a.Files is {Count: >0}) + .SelectMany(a => a.Files) + .FirstOrDefault(a => a.Path.EndsWith(".AppImage")); - var macTask = node.Tasks?.FirstOrDefault(t => t?.Name.Contains("macOS") ?? false); - var macArtifact = macTask?.Artifacts? - .Where(a => a?.Files is { Count: > 0 }) - .SelectMany(a => a!.Files!) - .FirstOrDefault(a => a?.Path.EndsWith(".dmg") ?? false); + var macTask = node.Tasks.FirstOrDefault(t => t.Name.Contains("macOS")); + var macArtifact = macTask?.Artifacts + .Where(a => a.Files is { Count: > 0 }) + .SelectMany(a => a.Files) + .FirstOrDefault(a => a.Path.EndsWith(".dmg")); var startTime = FromTimestamp(node.BuildCreatedTimestamp); var finishTime = GetFinishTime(node); @@ -142,7 +142,7 @@ public static class CirrusCi ? FromTimestamp(finalTimes.Max()!.Value) : node.ClockDurationInSeconds > 0 ? FromTimestamp(node.BuildCreatedTimestamp).AddSeconds(node.ClockDurationInSeconds.Value) - : (DateTime?)null; + : null; [return: NotNullIfNotNull(nameof(DateTime))] private static string? ToTimestamp(this DateTime? dateTime) => dateTime.HasValue ? (dateTime.Value.ToUniversalTime() - DateTime.UnixEpoch).TotalMilliseconds.ToString("0") : null; diff --git a/Clients/CirrusCiClient/CirrusCiClient.csproj b/Clients/CirrusCiClient/CirrusCiClient.csproj index 321b655c..4a44c3f7 100644 --- a/Clients/CirrusCiClient/CirrusCiClient.csproj +++ b/Clients/CirrusCiClient/CirrusCiClient.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 enable false @@ -8,9 +8,9 @@ - - - - + + + + \ No newline at end of file diff --git a/Clients/CompatApiClient/ApiConfig.cs b/Clients/CompatApiClient/ApiConfig.cs index c26f10c5..ccb47d04 100644 --- a/Clients/CompatApiClient/ApiConfig.cs +++ b/Clients/CompatApiClient/ApiConfig.cs @@ -22,59 +22,57 @@ public static class ApiConfig public static readonly ReturnCodeType ReturnCodes = new() { - {0, (true, false, true, "Results successfully retrieved.")}, - {1, (false, false, true, "No results.") }, - {2, (true, false, true, "No match was found, displaying results for: ***{0}***.") }, - {-1, (false, true, false, "{0}: Internal error occurred, please contact Ani and Nicba1010") }, - {-2, (false, true, false, "{0}: API is undergoing maintenance, please try again later.") }, - {-3, (false, false, false, "Illegal characters found, please try again with a different search term.") }, + [0] = (true, false, true, "Results successfully retrieved."), + [1] = (false, false, true, "No results."), + [2] = (true, false, true, "No match was found, displaying results for: ***{0}***."), + [-1] = (false, true, false, "{0}: Internal error occurred, please contact Ani and Nicba1010"), + [-2] = (false, true, false, "{0}: API is undergoing maintenance, please try again later."), + [-3] = (false, false, false, "Illegal characters found, please try again with a different search term."), }; public static readonly List ResultAmount = [25, 50, 100, 200]; public static readonly Dictionary Directions = new() { - {'a', ["a", "asc", "ascending"] }, - {'d', ["d", "desc", "descending"] }, + ['a'] = ["a", "asc", "ascending"], + ['d'] = ["d", "desc", "descending"], }; public static readonly Dictionary Statuses = new() { - {"all", 0 }, - {"playable", 1 }, - {"ingame", 2 }, - {"intro", 3 }, - {"loadable", 4 }, - {"nothing", 5 }, + ["all"] = 0, + ["playable"] = 1, + ["ingame"] = 2, + ["intro"] = 3, + ["loadable"] = 4, + ["nothing"] = 5, }; public static readonly Dictionary SortTypes = new() { - {"id", 1 }, - {"title", 2 }, - {"status", 3 }, - {"date", 4 }, + ["id"] = 1, + ["title"] = 2, + ["status"] = 3, + ["date"] = 4, }; public static readonly Dictionary ReleaseTypes = new() { - {'b', ["b", "d", "disc", "disk", "bluray", "blu-ray"] }, - {'n', ["n", "p", "PSN"] }, + ['b'] = ["b", "d", "disc", "disk", "bluray", "blu-ray"], + ['n'] = ["n", "p", "PSN"], }; public static readonly Dictionary ReverseDirections; public static readonly Dictionary ReverseReleaseTypes; private static Dictionary Reverse(this Dictionary dic, IEqualityComparer comparer) - where TK: notnull - where TV: notnull - { - return ( + where TK : notnull + where TV : notnull + => ( from kvp in dic from val in kvp.Value select (val, kvp.Key) ).ToDictionary(rkvp => rkvp.val, rkvp => rkvp.Key, comparer); - } public static readonly ILogger Log; public static readonly RecyclableMemoryStreamManager MemoryStreamManager = new(); diff --git a/Clients/CompatApiClient/Client.cs b/Clients/CompatApiClient/Client.cs index 78dd24ac..820f98c3 100644 --- a/Clients/CompatApiClient/Client.cs +++ b/Clients/CompatApiClient/Client.cs @@ -22,7 +22,7 @@ public class Client: IDisposable public Client() { client = HttpClientFactory.Create(new CompressionMessageHandler()); - jsonOptions = new JsonSerializerOptions + jsonOptions = new() { PropertyNamingPolicy = SpecialJsonNamingPolicy.SnakeCase, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, @@ -46,7 +46,7 @@ public class Client: IDisposable using var response = await client.SendAsync(message, HttpCompletionOption.ResponseContentRead, cancellationToken).ConfigureAwait(false); try { - await response.Content.LoadIntoBufferAsync().ConfigureAwait(false); + await response.Content.LoadIntoBufferAsync(cancellationToken).ConfigureAwait(false); var result = await response.Content.ReadFromJsonAsync(jsonOptions, cancellationToken).ConfigureAwait(false); if (result != null) { @@ -84,7 +84,7 @@ public class Client: IDisposable using var response = await client.SendAsync(message, HttpCompletionOption.ResponseContentRead, cancellationToken).ConfigureAwait(false); try { - await response.Content.LoadIntoBufferAsync().ConfigureAwait(false); + await response.Content.LoadIntoBufferAsync(cancellationToken).ConfigureAwait(false); result = await response.Content.ReadFromJsonAsync(jsonOptions, cancellationToken).ConfigureAwait(false); if (result != null) ResponseCache.Set(url, result, TimeSpan.FromDays(1)); diff --git a/Clients/CompatApiClient/CompatApiClient.csproj b/Clients/CompatApiClient/CompatApiClient.csproj index 06ccb6e4..cfe44126 100644 --- a/Clients/CompatApiClient/CompatApiClient.csproj +++ b/Clients/CompatApiClient/CompatApiClient.csproj @@ -1,21 +1,14 @@ - net8.0 + net9.0 enable - - - - latest - - - latest - + diff --git a/Clients/CompatApiClient/Compression/CompressionMessageHandler.cs b/Clients/CompatApiClient/Compression/CompressionMessageHandler.cs index ea8196b1..8a834c4c 100644 --- a/Clients/CompatApiClient/Compression/CompressionMessageHandler.cs +++ b/Clients/CompatApiClient/Compression/CompressionMessageHandler.cs @@ -21,11 +21,7 @@ public class CompressionMessageHandler : DelegatingHandler { this.isServer = isServer; isClient = !isServer; - Compressors = new ICompressor[] - { - new GZipCompressor(), - new DeflateCompressor(), - }; + Compressors = [new GZipCompressor(), new DeflateCompressor()]; } protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) diff --git a/Clients/CompatApiClient/Utils/UriExtensions.cs b/Clients/CompatApiClient/Utils/UriExtensions.cs index 54be0020..46e07aad 100644 --- a/Clients/CompatApiClient/Utils/UriExtensions.cs +++ b/Clients/CompatApiClient/Utils/UriExtensions.cs @@ -76,7 +76,7 @@ public static class UriExtensions if (value == null) continue; - result.AppendFormat("&{0}={1}", Uri.EscapeDataString(key), Uri.EscapeDataString(value)); + result.Append($"&{Uri.EscapeDataString(key)}={Uri.EscapeDataString(value)}"); } if (result.Length == 0) return ""; @@ -103,7 +103,7 @@ public static class UriExtensions } else { - var startWithSlash = uri.OriginalString.StartsWith("/"); + var startWithSlash = uri.OriginalString.StartsWith('/'); uri = new(FakeHost, uri); var builder = new UriBuilder(uri) { Query = value }; var additionalStrip = startWithSlash ? 0 : 1; diff --git a/Clients/GithubClient/GithubClient.csproj b/Clients/GithubClient/GithubClient.csproj index fe6c2998..9117bbcf 100644 --- a/Clients/GithubClient/GithubClient.csproj +++ b/Clients/GithubClient/GithubClient.csproj @@ -1,11 +1,11 @@ - net8.0 + net9.0 latest enable - + diff --git a/Clients/IrdLibraryClient/IrdFormat/IrdParser.cs b/Clients/IrdLibraryClient/IrdFormat/IrdParser.cs index cf2d4e92..71ea47ca 100644 --- a/Clients/IrdLibraryClient/IrdFormat/IrdParser.cs +++ b/Clients/IrdLibraryClient/IrdFormat/IrdParser.cs @@ -47,11 +47,11 @@ public static class IrdParser result.FooterLength = reader.ReadInt32(); result.Footer = reader.ReadBytes(result.FooterLength); result.RegionCount = reader.ReadByte(); - result.RegionMd5Checksums = new List(result.RegionCount); + result.RegionMd5Checksums = new(result.RegionCount); for (var i = 0; i < result.RegionCount; i++) result.RegionMd5Checksums.Add(reader.ReadBytes(16)); result.FileCount = reader.ReadInt32(); - result.Files = new List(result.FileCount); + result.Files = new(result.FileCount); for (var i = 0; i < result.FileCount; i++) { // ReSharper disable once UseObjectOrCollectionInitializer diff --git a/Clients/IrdLibraryClient/IrdLibraryClient.csproj b/Clients/IrdLibraryClient/IrdLibraryClient.csproj index f84c0bcf..a3968d2a 100644 --- a/Clients/IrdLibraryClient/IrdLibraryClient.csproj +++ b/Clients/IrdLibraryClient/IrdLibraryClient.csproj @@ -1,13 +1,13 @@ - net8.0 + net9.0 latest enable - + diff --git a/Clients/MediafireClient/MediafireClient.csproj b/Clients/MediafireClient/MediafireClient.csproj index 1e501172..848a1044 100644 --- a/Clients/MediafireClient/MediafireClient.csproj +++ b/Clients/MediafireClient/MediafireClient.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 enable diff --git a/Clients/OneDriveClient/OneDriveClient.csproj b/Clients/OneDriveClient/OneDriveClient.csproj index 1e501172..848a1044 100644 --- a/Clients/OneDriveClient/OneDriveClient.csproj +++ b/Clients/OneDriveClient/OneDriveClient.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 enable diff --git a/Clients/PsnClient/CustomTlsCertificatesHandler.cs b/Clients/PsnClient/CustomTlsCertificatesHandler.cs index 92b4ceed..3db784fb 100644 --- a/Clients/PsnClient/CustomTlsCertificatesHandler.cs +++ b/Clients/PsnClient/CustomTlsCertificatesHandler.cs @@ -37,7 +37,7 @@ public class CustomTlsCertificatesHandler: HttpClientHandler if (certData.Length == 0) continue; - var cert = new X509Certificate2(certData); + var cert = X509CertificateLoader.LoadCertificate(certData); var cn = cert.GetNameInfo(X509NameType.SimpleName, false); if (!cn.StartsWith("SCEI DNAS Root")) continue; diff --git a/Clients/PsnClient/PsnClient.csproj b/Clients/PsnClient/PsnClient.csproj index 50708334..053f20f0 100644 --- a/Clients/PsnClient/PsnClient.csproj +++ b/Clients/PsnClient/PsnClient.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0 enable @@ -11,7 +11,7 @@ - + diff --git a/Clients/YandexDiskClient/YandexDiskClient.csproj b/Clients/YandexDiskClient/YandexDiskClient.csproj index 1e501172..848a1044 100644 --- a/Clients/YandexDiskClient/YandexDiskClient.csproj +++ b/Clients/YandexDiskClient/YandexDiskClient.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 enable diff --git a/CompatBot/CompatBot.csproj b/CompatBot/CompatBot.csproj index 7cbb0116..6ca92bf8 100644 --- a/CompatBot/CompatBot.csproj +++ b/CompatBot/CompatBot.csproj @@ -1,7 +1,7 @@  Exe - net8.0 + net9.0 true CompatBot c2e6548b-b215-4a18-a010-958ef294b310 @@ -43,22 +43,22 @@ - + - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + @@ -68,7 +68,7 @@ - + diff --git a/CompatBot/EventHandlers/BotReactionsHandler.cs b/CompatBot/EventHandlers/BotReactionsHandler.cs index 8ec894a6..a5bb416e 100644 --- a/CompatBot/EventHandlers/BotReactionsHandler.cs +++ b/CompatBot/EventHandlers/BotReactionsHandler.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using System.Text.RegularExpressions; +using System.Threading; using System.Threading.Tasks; using CompatBot.Commands.Attributes; using CompatBot.Database; @@ -72,7 +73,7 @@ namespace CompatBot.EventHandlers [GeneratedRegex(@"\b((?kot(to)?)|(?doggo|jarves))\b", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.ExplicitCapture)] private static partial Regex Paws(); private static readonly Random Rng = new(); - private static readonly object TheDoor = new(); + private static readonly Lock TheDoor = new(); public static DiscordEmoji RandomNegativeReaction { get { lock (TheDoor) return SadReactions[Rng.Next(SadReactions.Length)]; } } public static DiscordEmoji RandomPositiveReaction { get { lock (TheDoor) return ThankYouReactions[Rng.Next(ThankYouReactions.Length)]; } } diff --git a/CompatBot/Utils/BufferCopyStream.cs b/CompatBot/Utils/BufferCopyStream.cs index 46a89834..8a8c8a5f 100644 --- a/CompatBot/Utils/BufferCopyStream.cs +++ b/CompatBot/Utils/BufferCopyStream.cs @@ -1,6 +1,7 @@ using System; using System.Buffers; using System.IO; +using System.Threading; namespace CompatBot.Utils; @@ -14,7 +15,7 @@ internal class BufferCopyStream : Stream, IDisposable private readonly byte[] writeBuf; private readonly byte[] readBuf; private int bufStart, bufLength; - private readonly object sync = new(); + private readonly Lock sync = new(); private bool disposed; public BufferCopyStream(Stream? baseStream, int bufferSize = 4096) diff --git a/CompatBot/Utils/FixedLengthBuffer.cs b/CompatBot/Utils/FixedLengthBuffer.cs index cc4b9005..0971d3a0 100644 --- a/CompatBot/Utils/FixedLengthBuffer.cs +++ b/CompatBot/Utils/FixedLengthBuffer.cs @@ -2,13 +2,14 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Threading; namespace CompatBot.Utils; internal class FixedLengthBuffer: IList where TKey: notnull { - internal readonly object SyncObj = new(); + internal readonly Lock SyncObj = new(); public FixedLengthBuffer(Func keyGenerator) { diff --git a/Dockerfile b/Dockerfile index 4d21a9ee..085b4a34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS base +FROM mcr.microsoft.com/dotnet/sdk:9.0-noble AS base # Native libgdiplus dependencies RUN apt-get update diff --git a/HomoglyphConverter/HomoglyphConverter.csproj b/HomoglyphConverter/HomoglyphConverter.csproj index 372d377f..3d78965e 100644 --- a/HomoglyphConverter/HomoglyphConverter.csproj +++ b/HomoglyphConverter/HomoglyphConverter.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 latest enable false diff --git a/README.md b/README.md index 9a1ac855..743044a9 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,15 @@ You can read the design and implementation notes by visiting the folders in the Development Requirements ------------------------ -* [.NET 8.0 SDK](https://dotnet.microsoft.com/download) or newer +* [.NET 9.0 SDK](https://dotnet.microsoft.com/download) or newer * Any text editor, but here are some recommends: - * [Visual Studio](https://visualstudio.microsoft.com/) (Windows and Mac only, has free Community edition) + * [Visual Studio](https://visualstudio.microsoft.com/) (Windows, has free Community edition) * [Visual Studio Code](https://code.visualstudio.com/) (cross-platform, free) - * [JetBrains Rider](https://www.jetbrains.com/rider/) (cross-platform) + * [JetBrains Rider](https://www.jetbrains.com/rider/) (cross-platform, free for Non-Commercial use) Runtime Requirements -------------------- -* [.NET 8.0 SDK](https://dotnet.microsoft.com/download) or newer to run from sources +* [.NET 9.0 SDK](https://dotnet.microsoft.com/download) or newer to run from sources * bot needs `dotnet` command to be available (i.e. alias for the Snap package) * Optionally Google API credentials to access Google Drive: * Create new project in the [Google Cloud Resource Manager](https://console.developers.google.com/cloud-resource-manager) diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 9b2de4e0..9e2d5d5e 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -1,18 +1,18 @@  - net8.0 + net9.0 false - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive