Merge pull request #964 from 13xforever/vnext
Some checks failed
.NET / Run Tests (push) Has been cancelled
.NET / Build Release (push) Has been cancelled
.NET / ConfigTest (push) Has been cancelled
.NET / Build Docker image (push) Has been cancelled
CodeQL Advanced / Analyze (${{ matrix.language }}) (manual, csharp) (push) Has been cancelled

Upgrade to .NET 9
This commit is contained in:
Haxy 2024-11-20 12:15:03 +00:00 committed by GitHub
commit 09aedeb56f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 182 additions and 178 deletions

View File

@ -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
}
}
}

View File

@ -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
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
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
# 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' }}
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
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.
# 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
# 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
- name: Build
# 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
# 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
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"

View File

@ -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'

View File

@ -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`.

View File

@ -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;

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<EmitCompilerGeneratedFiles>false</EmitCompilerGeneratedFiles>
</PropertyGroup>
@ -8,9 +8,9 @@
<ProjectReference Include="..\CompatApiClient\CompatApiClient.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageReference Include="StrawberryShake.Server" Version="13.9.14" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageReference Include="StrawberryShake.Server" Version="14.1.0" />
</ItemGroup>
</Project>

View File

@ -22,44 +22,44 @@ 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<int> ResultAmount = [25, 50, 100, 200];
public static readonly Dictionary<char, string[]> Directions = new()
{
{'a', ["a", "asc", "ascending"] },
{'d', ["d", "desc", "descending"] },
['a'] = ["a", "asc", "ascending"],
['d'] = ["d", "desc", "descending"],
};
public static readonly Dictionary<string, int> 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<string, int> SortTypes = new()
{
{"id", 1 },
{"title", 2 },
{"status", 3 },
{"date", 4 },
["id"] = 1,
["title"] = 2,
["status"] = 3,
["date"] = 4,
};
public static readonly Dictionary<char, string[]> 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<string, char> ReverseDirections;
@ -68,13 +68,11 @@ public static class ApiConfig
private static Dictionary<TV, TK> Reverse<TK, TV>(this Dictionary<TK, TV[]> dic, IEqualityComparer<TV> comparer)
where TK : notnull
where TV : notnull
{
return (
=> (
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();

View File

@ -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<CompatResult>(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<CompatResult>(jsonOptions, cancellationToken).ConfigureAwait(false);
if (result != null)
ResponseCache.Set(url, result, TimeSpan.FromDays(1));

View File

@ -1,21 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageReference Include="NLog" Version="5.3.4" />
</ItemGroup>

View File

@ -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<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)

View File

@ -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;

View File

@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Include="Octokit" Version="13.0.1" />
</ItemGroup>
<ItemGroup>

View File

@ -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<byte[]>(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<IrdFile>(result.FileCount);
result.Files = new(result.FileCount);
for (var i = 0; i < result.FileCount; i++)
{
// ReSharper disable once UseObjectOrCollectionInitializer

View File

@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DiscUtils.OpticalDisk" Version="0.16.13" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
<PackageReference Include="System.IO.Hashing" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CompatApiClient\CompatApiClient.csproj" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>

View File

@ -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;

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@ -11,7 +11,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
</ItemGroup>
<ItemGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<TieredCompilation>true</TieredCompilation>
<RootNamespace>CompatBot</RootNamespace>
<UserSecretsId>c2e6548b-b215-4a18-a010-958ef294b310</UserSecretsId>
@ -43,22 +43,22 @@
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.5.0" />
<PackageReference Include="DSharpPlus.Interactivity" Version="4.5.0" />
<PackageReference Include="DSharpPlus.SlashCommands" Version="4.5.0" />
<PackageReference Include="Google.Apis.Drive.v3" Version="1.68.0.3568" />
<PackageReference Include="Google.Apis.Drive.v3" Version="1.68.0.3587" />
<PackageReference Include="ksemenenko.ColorThief" Version="1.1.1.4" />
<PackageReference Include="MathParser.org-mXparser" Version="6.0.0" />
<PackageReference Include="MathParser.org-mXparser" Version="6.1.0" />
<PackageReference Include="MegaApiClient" Version="1.10.4" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.22.0" />
<PackageReference Include="Microsoft.ApplicationInsights.PerfCounterCollector" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.Vision.ComputerVision" Version="7.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="19.225.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
@ -68,7 +68,7 @@
<PackageReference Include="NReco.Text.AhoCorasickDoubleArrayTrie" Version="1.1.1" />
<PackageReference Include="SharpCompress" Version="0.38.0" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.4" />
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Clients\CirrusCiClient\CirrusCiClient.csproj" />

View File

@ -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>kot(to)?)|(?<doggo>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)]; } }

View File

@ -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)

View File

@ -2,13 +2,14 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace CompatBot.Utils;
internal class FixedLengthBuffer<TKey, TValue>: IList<TValue>
where TKey: notnull
{
internal readonly object SyncObj = new();
internal readonly Lock SyncObj = new();
public FixedLengthBuffer(Func<TValue, TKey> keyGenerator)
{

View File

@ -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

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<EmitCompilerGeneratedFiles>false</EmitCompilerGeneratedFiles>

View File

@ -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)

View File

@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DuoVia.FuzzyStrings" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit.Analyzers" Version="4.3.0">
<PackageReference Include="NUnit.Analyzers" Version="4.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>