mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-11-26 19:50:36 +00:00
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
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:
commit
09aedeb56f
@ -3,16 +3,18 @@
|
|||||||
"isRoot": true,
|
"isRoot": true,
|
||||||
"tools": {
|
"tools": {
|
||||||
"strawberryshake.tools": {
|
"strawberryshake.tools": {
|
||||||
"version": "13.7.0",
|
"version": "14.1.0",
|
||||||
"commands": [
|
"commands": [
|
||||||
"dotnet-graphql"
|
"dotnet-graphql"
|
||||||
]
|
],
|
||||||
|
"rollForward": false
|
||||||
},
|
},
|
||||||
"dotnet-ef": {
|
"dotnet-ef": {
|
||||||
"version": "8.0.0",
|
"version": "9.0.0",
|
||||||
"commands": [
|
"commands": [
|
||||||
"dotnet-ef"
|
"dotnet-ef"
|
||||||
]
|
],
|
||||||
|
"rollForward": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
125
.github/workflows/codeql-analysis.yml
vendored
125
.github/workflows/codeql-analysis.yml
vendored
@ -3,77 +3,88 @@
|
|||||||
#
|
#
|
||||||
# You may wish to alter this file to override the set of languages analyzed,
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
# or to provide custom queries or build logic.
|
# or to provide custom queries or build logic.
|
||||||
name: "CodeQL"
|
#
|
||||||
|
|
||||||
|
name: "CodeQL Advanced"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [vnext]
|
branches: [ "vnext" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
branches: [ "vnext" ]
|
||||||
branches: [vnext]
|
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 19 * * 3'
|
- cron: '36 10 * * 0'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
name: Analyze
|
name: Analyze (${{ matrix.language }})
|
||||||
runs-on: ubuntu-latest
|
# 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:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# Override automatic language detection by changing the below list
|
include:
|
||||||
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
|
- language: csharp
|
||||||
language: ['csharp']
|
build-mode: manual
|
||||||
# Learn more...
|
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
|
||||||
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
|
# 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:
|
steps:
|
||||||
- name: Update dotnet
|
- name: Update dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: '8.0.x'
|
dotnet-version: |
|
||||||
|
8.0.x
|
||||||
|
9.0.x
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
# We must fetch at least the immediate parents so that if this is
|
# Initializes the CodeQL tools for scanning.
|
||||||
# a pull request then we can checkout the head.
|
- name: Initialize CodeQL
|
||||||
fetch-depth: 2
|
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
|
# If the analyze step fails for one of the languages you are analyzing with
|
||||||
# the head of the pull request instead of the merge commit.
|
# "We were unable to automatically build your code", modify the matrix above
|
||||||
- run: git checkout HEAD^2
|
# to set the build mode to "manual" for that language. Then modify this step
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
# 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: Perform CodeQL Analysis
|
||||||
- name: Initialize CodeQL
|
uses: github/codeql-action/analyze@v3
|
||||||
uses: github/codeql-action/init@v1
|
with:
|
||||||
with:
|
category: "/language:${{matrix.language}}"
|
||||||
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
|
|
||||||
|
30
.github/workflows/dotnet.yml
vendored
30
.github/workflows/dotnet.yml
vendored
@ -11,11 +11,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: "Run Tests"
|
name: "Run Tests"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- name: update dotnet core sdk
|
- name: update dotnet core sdk
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: |
|
||||||
|
8.0.x
|
||||||
|
9.0.x
|
||||||
- name: dotnet restore (first try)
|
- name: dotnet restore (first try)
|
||||||
run: dotnet restore --ignore-failed-sources
|
run: dotnet restore --ignore-failed-sources
|
||||||
- name: dotnet restore (second try)
|
- name: dotnet restore (second try)
|
||||||
@ -31,11 +33,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: "Build Release"
|
name: "Build Release"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- name: update dotnet core sdk
|
- name: update dotnet core sdk
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: |
|
||||||
|
8.0.x
|
||||||
|
9.0.x
|
||||||
- name: dotnet restore (first try)
|
- name: dotnet restore (first try)
|
||||||
run: dotnet restore --ignore-failed-sources
|
run: dotnet restore --ignore-failed-sources
|
||||||
- name: dotnet restore (second try)
|
- name: dotnet restore (second try)
|
||||||
@ -62,15 +66,17 @@ jobs:
|
|||||||
name: "Build Docker image"
|
name: "Build Docker image"
|
||||||
if: (github.ref == 'refs/heads/master') && (needs.ConfigTest.outputs.docker-username == 'true')
|
if: (github.ref == 'refs/heads/master') && (needs.ConfigTest.outputs.docker-username == 'true')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: "clean build artifacts"
|
- name: "clean build artifacts"
|
||||||
run: git clean -dfx
|
run: git clean -dfx
|
||||||
- name: update dotnet core sdk
|
- name: update dotnet core sdk
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: |
|
||||||
|
8.0.x
|
||||||
|
9.0.x
|
||||||
- name: dotnet restore (first try)
|
- name: dotnet restore (first try)
|
||||||
run: dotnet restore --ignore-failed-sources
|
run: dotnet restore --ignore-failed-sources
|
||||||
- name: dotnet restore (second try)
|
- name: dotnet restore (second try)
|
||||||
@ -80,9 +86,9 @@ jobs:
|
|||||||
- name: dotnet build Release
|
- name: dotnet build Release
|
||||||
run: dotnet build --no-restore --configuration Release
|
run: dotnet build --no-restore --configuration Release
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
@ -91,7 +97,7 @@ jobs:
|
|||||||
NUM: ${{ github.run_number }}
|
NUM: ${{ github.run_number }}
|
||||||
run: echo "GITHUB_RUN_NUMBER_WITH_OFFSET=$(($NUM+1050))" >> $GITHUB_ENV
|
run: echo "GITHUB_RUN_NUMBER_WITH_OFFSET=$(($NUM+1050))" >> $GITHUB_ENV
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: 'true'
|
push: 'true'
|
||||||
|
@ -16,8 +16,3 @@ Recommended development setup
|
|||||||
See [readme](README.md) for detailed requirement and recommended IDE 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.
|
**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`.
|
|
@ -37,27 +37,27 @@ public static class CirrusCi
|
|||||||
queryResult.EnsureNoErrors();
|
queryResult.EnsureNoErrors();
|
||||||
if (queryResult.Data?.OwnerRepository?.Builds?.Edges is {Count: > 0} edgeList)
|
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)
|
if (node is null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var winTask = node.Tasks?.FirstOrDefault(t => t?.Name.Contains("Windows") ?? false);
|
var winTask = node.Tasks.FirstOrDefault(t => t.Name.Contains("Windows"));
|
||||||
var winArtifact = winTask?.Artifacts?
|
var winArtifact = winTask?.Artifacts
|
||||||
.Where(a => a?.Files is {Count: >0})
|
.Where(a => a.Files is {Count: >0})
|
||||||
.SelectMany(a => a!.Files!)
|
.SelectMany(a => a.Files)
|
||||||
.FirstOrDefault(f => f?.Path.EndsWith(".7z") ?? false);
|
.FirstOrDefault(f => f.Path.EndsWith(".7z"));
|
||||||
|
|
||||||
var linTask = node.Tasks?.FirstOrDefault(t => t is {} lt && lt.Name.Contains("Linux") && lt.Name.Contains("GCC"));
|
var linTask = node.Tasks.FirstOrDefault(t => t is {} lt && lt.Name.Contains("Linux") && lt.Name.Contains("GCC"));
|
||||||
var linArtifact = linTask?.Artifacts?
|
var linArtifact = linTask?.Artifacts
|
||||||
.Where(a => a?.Files is {Count: >0})
|
.Where(a => a.Files is {Count: >0})
|
||||||
.SelectMany(a => a!.Files!)
|
.SelectMany(a => a.Files)
|
||||||
.FirstOrDefault(a => a?.Path.EndsWith(".AppImage") ?? false);
|
.FirstOrDefault(a => a.Path.EndsWith(".AppImage"));
|
||||||
|
|
||||||
var macTask = node.Tasks?.FirstOrDefault(t => t?.Name.Contains("macOS") ?? false);
|
var macTask = node.Tasks.FirstOrDefault(t => t.Name.Contains("macOS"));
|
||||||
var macArtifact = macTask?.Artifacts?
|
var macArtifact = macTask?.Artifacts
|
||||||
.Where(a => a?.Files is { Count: > 0 })
|
.Where(a => a.Files is { Count: > 0 })
|
||||||
.SelectMany(a => a!.Files!)
|
.SelectMany(a => a.Files)
|
||||||
.FirstOrDefault(a => a?.Path.EndsWith(".dmg") ?? false);
|
.FirstOrDefault(a => a.Path.EndsWith(".dmg"));
|
||||||
|
|
||||||
var startTime = FromTimestamp(node.BuildCreatedTimestamp);
|
var startTime = FromTimestamp(node.BuildCreatedTimestamp);
|
||||||
var finishTime = GetFinishTime(node);
|
var finishTime = GetFinishTime(node);
|
||||||
@ -142,7 +142,7 @@ public static class CirrusCi
|
|||||||
? FromTimestamp(finalTimes.Max()!.Value)
|
? FromTimestamp(finalTimes.Max()!.Value)
|
||||||
: node.ClockDurationInSeconds > 0
|
: node.ClockDurationInSeconds > 0
|
||||||
? FromTimestamp(node.BuildCreatedTimestamp).AddSeconds(node.ClockDurationInSeconds.Value)
|
? FromTimestamp(node.BuildCreatedTimestamp).AddSeconds(node.ClockDurationInSeconds.Value)
|
||||||
: (DateTime?)null;
|
: null;
|
||||||
|
|
||||||
[return: NotNullIfNotNull(nameof(DateTime))]
|
[return: NotNullIfNotNull(nameof(DateTime))]
|
||||||
private static string? ToTimestamp(this DateTime? dateTime) => dateTime.HasValue ? (dateTime.Value.ToUniversalTime() - DateTime.UnixEpoch).TotalMilliseconds.ToString("0") : null;
|
private static string? ToTimestamp(this DateTime? dateTime) => dateTime.HasValue ? (dateTime.Value.ToUniversalTime() - DateTime.UnixEpoch).TotalMilliseconds.ToString("0") : null;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<EmitCompilerGeneratedFiles>false</EmitCompilerGeneratedFiles>
|
<EmitCompilerGeneratedFiles>false</EmitCompilerGeneratedFiles>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -8,9 +8,9 @@
|
|||||||
<ProjectReference Include="..\CompatApiClient\CompatApiClient.csproj" />
|
<ProjectReference Include="..\CompatApiClient\CompatApiClient.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
|
||||||
<PackageReference Include="StrawberryShake.Server" Version="13.9.14" />
|
<PackageReference Include="StrawberryShake.Server" Version="14.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -22,59 +22,57 @@ public static class ApiConfig
|
|||||||
|
|
||||||
public static readonly ReturnCodeType ReturnCodes = new()
|
public static readonly ReturnCodeType ReturnCodes = new()
|
||||||
{
|
{
|
||||||
{0, (true, false, true, "Results successfully retrieved.")},
|
[0] = (true, false, true, "Results successfully retrieved."),
|
||||||
{1, (false, false, true, "No results.") },
|
[1] = (false, false, true, "No results."),
|
||||||
{2, (true, false, true, "No match was found, displaying results for: ***{0}***.") },
|
[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") },
|
[-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.") },
|
[-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.") },
|
[-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 List<int> ResultAmount = [25, 50, 100, 200];
|
||||||
|
|
||||||
public static readonly Dictionary<char, string[]> Directions = new()
|
public static readonly Dictionary<char, string[]> Directions = new()
|
||||||
{
|
{
|
||||||
{'a', ["a", "asc", "ascending"] },
|
['a'] = ["a", "asc", "ascending"],
|
||||||
{'d', ["d", "desc", "descending"] },
|
['d'] = ["d", "desc", "descending"],
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly Dictionary<string, int> Statuses = new()
|
public static readonly Dictionary<string, int> Statuses = new()
|
||||||
{
|
{
|
||||||
{"all", 0 },
|
["all"] = 0,
|
||||||
{"playable", 1 },
|
["playable"] = 1,
|
||||||
{"ingame", 2 },
|
["ingame"] = 2,
|
||||||
{"intro", 3 },
|
["intro"] = 3,
|
||||||
{"loadable", 4 },
|
["loadable"] = 4,
|
||||||
{"nothing", 5 },
|
["nothing"] = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly Dictionary<string, int> SortTypes = new()
|
public static readonly Dictionary<string, int> SortTypes = new()
|
||||||
{
|
{
|
||||||
{"id", 1 },
|
["id"] = 1,
|
||||||
{"title", 2 },
|
["title"] = 2,
|
||||||
{"status", 3 },
|
["status"] = 3,
|
||||||
{"date", 4 },
|
["date"] = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly Dictionary<char, string[]> ReleaseTypes = new()
|
public static readonly Dictionary<char, string[]> ReleaseTypes = new()
|
||||||
{
|
{
|
||||||
{'b', ["b", "d", "disc", "disk", "bluray", "blu-ray"] },
|
['b'] = ["b", "d", "disc", "disk", "bluray", "blu-ray"],
|
||||||
{'n', ["n", "p", "PSN"] },
|
['n'] = ["n", "p", "PSN"],
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly Dictionary<string, char> ReverseDirections;
|
public static readonly Dictionary<string, char> ReverseDirections;
|
||||||
public static readonly Dictionary<string, char> ReverseReleaseTypes;
|
public static readonly Dictionary<string, char> ReverseReleaseTypes;
|
||||||
|
|
||||||
private static Dictionary<TV, TK> Reverse<TK, TV>(this Dictionary<TK, TV[]> dic, IEqualityComparer<TV> comparer)
|
private static Dictionary<TV, TK> Reverse<TK, TV>(this Dictionary<TK, TV[]> dic, IEqualityComparer<TV> comparer)
|
||||||
where TK: notnull
|
where TK : notnull
|
||||||
where TV: notnull
|
where TV : notnull
|
||||||
{
|
=> (
|
||||||
return (
|
|
||||||
from kvp in dic
|
from kvp in dic
|
||||||
from val in kvp.Value
|
from val in kvp.Value
|
||||||
select (val, kvp.Key)
|
select (val, kvp.Key)
|
||||||
).ToDictionary(rkvp => rkvp.val, rkvp => rkvp.Key, comparer);
|
).ToDictionary(rkvp => rkvp.val, rkvp => rkvp.Key, comparer);
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly ILogger Log;
|
public static readonly ILogger Log;
|
||||||
public static readonly RecyclableMemoryStreamManager MemoryStreamManager = new();
|
public static readonly RecyclableMemoryStreamManager MemoryStreamManager = new();
|
||||||
|
@ -22,7 +22,7 @@ public class Client: IDisposable
|
|||||||
public Client()
|
public Client()
|
||||||
{
|
{
|
||||||
client = HttpClientFactory.Create(new CompressionMessageHandler());
|
client = HttpClientFactory.Create(new CompressionMessageHandler());
|
||||||
jsonOptions = new JsonSerializerOptions
|
jsonOptions = new()
|
||||||
{
|
{
|
||||||
PropertyNamingPolicy = SpecialJsonNamingPolicy.SnakeCase,
|
PropertyNamingPolicy = SpecialJsonNamingPolicy.SnakeCase,
|
||||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||||
@ -46,7 +46,7 @@ public class Client: IDisposable
|
|||||||
using var response = await client.SendAsync(message, HttpCompletionOption.ResponseContentRead, cancellationToken).ConfigureAwait(false);
|
using var response = await client.SendAsync(message, HttpCompletionOption.ResponseContentRead, cancellationToken).ConfigureAwait(false);
|
||||||
try
|
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);
|
var result = await response.Content.ReadFromJsonAsync<CompatResult>(jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ public class Client: IDisposable
|
|||||||
using var response = await client.SendAsync(message, HttpCompletionOption.ResponseContentRead, cancellationToken).ConfigureAwait(false);
|
using var response = await client.SendAsync(message, HttpCompletionOption.ResponseContentRead, cancellationToken).ConfigureAwait(false);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await response.Content.LoadIntoBufferAsync().ConfigureAwait(false);
|
await response.Content.LoadIntoBufferAsync(cancellationToken).ConfigureAwait(false);
|
||||||
result = await response.Content.ReadFromJsonAsync<CompatResult>(jsonOptions, cancellationToken).ConfigureAwait(false);
|
result = await response.Content.ReadFromJsonAsync<CompatResult>(jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
ResponseCache.Set(url, result, TimeSpan.FromDays(1));
|
ResponseCache.Set(url, result, TimeSpan.FromDays(1));
|
||||||
|
@ -1,21 +1,14 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<LangVersion>latest</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
|
<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="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
|
||||||
<PackageReference Include="NLog" Version="5.3.4" />
|
<PackageReference Include="NLog" Version="5.3.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -21,11 +21,7 @@ public class CompressionMessageHandler : DelegatingHandler
|
|||||||
{
|
{
|
||||||
this.isServer = isServer;
|
this.isServer = isServer;
|
||||||
isClient = !isServer;
|
isClient = !isServer;
|
||||||
Compressors = new ICompressor[]
|
Compressors = [new GZipCompressor(), new DeflateCompressor()];
|
||||||
{
|
|
||||||
new GZipCompressor(),
|
|
||||||
new DeflateCompressor(),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||||
|
@ -76,7 +76,7 @@ public static class UriExtensions
|
|||||||
if (value == null)
|
if (value == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
result.AppendFormat("&{0}={1}", Uri.EscapeDataString(key), Uri.EscapeDataString(value));
|
result.Append($"&{Uri.EscapeDataString(key)}={Uri.EscapeDataString(value)}");
|
||||||
}
|
}
|
||||||
if (result.Length == 0)
|
if (result.Length == 0)
|
||||||
return "";
|
return "";
|
||||||
@ -103,7 +103,7 @@ public static class UriExtensions
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var startWithSlash = uri.OriginalString.StartsWith("/");
|
var startWithSlash = uri.OriginalString.StartsWith('/');
|
||||||
uri = new(FakeHost, uri);
|
uri = new(FakeHost, uri);
|
||||||
var builder = new UriBuilder(uri) { Query = value };
|
var builder = new UriBuilder(uri) { Query = value };
|
||||||
var additionalStrip = startWithSlash ? 0 : 1;
|
var additionalStrip = startWithSlash ? 0 : 1;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<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" />
|
<PackageReference Include="Octokit" Version="13.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -47,11 +47,11 @@ public static class IrdParser
|
|||||||
result.FooterLength = reader.ReadInt32();
|
result.FooterLength = reader.ReadInt32();
|
||||||
result.Footer = reader.ReadBytes(result.FooterLength);
|
result.Footer = reader.ReadBytes(result.FooterLength);
|
||||||
result.RegionCount = reader.ReadByte();
|
result.RegionCount = reader.ReadByte();
|
||||||
result.RegionMd5Checksums = new List<byte[]>(result.RegionCount);
|
result.RegionMd5Checksums = new(result.RegionCount);
|
||||||
for (var i = 0; i < result.RegionCount; i++)
|
for (var i = 0; i < result.RegionCount; i++)
|
||||||
result.RegionMd5Checksums.Add(reader.ReadBytes(16));
|
result.RegionMd5Checksums.Add(reader.ReadBytes(16));
|
||||||
result.FileCount = reader.ReadInt32();
|
result.FileCount = reader.ReadInt32();
|
||||||
result.Files = new List<IrdFile>(result.FileCount);
|
result.Files = new(result.FileCount);
|
||||||
for (var i = 0; i < result.FileCount; i++)
|
for (var i = 0; i < result.FileCount; i++)
|
||||||
{
|
{
|
||||||
// ReSharper disable once UseObjectOrCollectionInitializer
|
// ReSharper disable once UseObjectOrCollectionInitializer
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DiscUtils.OpticalDisk" Version="0.16.13" />
|
<PackageReference Include="DiscUtils.OpticalDisk" Version="0.16.13" />
|
||||||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
|
<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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\CompatApiClient\CompatApiClient.csproj" />
|
<ProjectReference Include="..\CompatApiClient\CompatApiClient.csproj" />
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -37,7 +37,7 @@ public class CustomTlsCertificatesHandler: HttpClientHandler
|
|||||||
if (certData.Length == 0)
|
if (certData.Length == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var cert = new X509Certificate2(certData);
|
var cert = X509CertificateLoader.LoadCertificate(certData);
|
||||||
var cn = cert.GetNameInfo(X509NameType.SimpleName, false);
|
var cn = cert.GetNameInfo(X509NameType.SimpleName, false);
|
||||||
if (!cn.StartsWith("SCEI DNAS Root"))
|
if (!cn.StartsWith("SCEI DNAS Root"))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
|
<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="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<TieredCompilation>true</TieredCompilation>
|
<TieredCompilation>true</TieredCompilation>
|
||||||
<RootNamespace>CompatBot</RootNamespace>
|
<RootNamespace>CompatBot</RootNamespace>
|
||||||
<UserSecretsId>c2e6548b-b215-4a18-a010-958ef294b310</UserSecretsId>
|
<UserSecretsId>c2e6548b-b215-4a18-a010-958ef294b310</UserSecretsId>
|
||||||
@ -43,22 +43,22 @@
|
|||||||
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.5.0" />
|
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.5.0" />
|
||||||
<PackageReference Include="DSharpPlus.Interactivity" Version="4.5.0" />
|
<PackageReference Include="DSharpPlus.Interactivity" Version="4.5.0" />
|
||||||
<PackageReference Include="DSharpPlus.SlashCommands" 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="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="MegaApiClient" Version="1.10.4" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.22.0" />
|
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.22.0" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.PerfCounterCollector" 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.Azure.CognitiveServices.Vision.ComputerVision" Version="7.0.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
|
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
|
||||||
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="19.225.1" />
|
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="19.225.1" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
<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="NReco.Text.AhoCorasickDoubleArrayTrie" Version="1.1.1" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.38.0" />
|
<PackageReference Include="SharpCompress" Version="0.38.0" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.4" />
|
<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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Clients\CirrusCiClient\CirrusCiClient.csproj" />
|
<ProjectReference Include="..\Clients\CirrusCiClient\CirrusCiClient.csproj" />
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CompatBot.Commands.Attributes;
|
using CompatBot.Commands.Attributes;
|
||||||
using CompatBot.Database;
|
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)]
|
[GeneratedRegex(@"\b((?<kot>kot(to)?)|(?<doggo>doggo|jarves))\b", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.ExplicitCapture)]
|
||||||
private static partial Regex Paws();
|
private static partial Regex Paws();
|
||||||
private static readonly Random Rng = new();
|
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 RandomNegativeReaction { get { lock (TheDoor) return SadReactions[Rng.Next(SadReactions.Length)]; } }
|
||||||
public static DiscordEmoji RandomPositiveReaction { get { lock (TheDoor) return ThankYouReactions[Rng.Next(ThankYouReactions.Length)]; } }
|
public static DiscordEmoji RandomPositiveReaction { get { lock (TheDoor) return ThankYouReactions[Rng.Next(ThankYouReactions.Length)]; } }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace CompatBot.Utils;
|
namespace CompatBot.Utils;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ internal class BufferCopyStream : Stream, IDisposable
|
|||||||
private readonly byte[] writeBuf;
|
private readonly byte[] writeBuf;
|
||||||
private readonly byte[] readBuf;
|
private readonly byte[] readBuf;
|
||||||
private int bufStart, bufLength;
|
private int bufStart, bufLength;
|
||||||
private readonly object sync = new();
|
private readonly Lock sync = new();
|
||||||
private bool disposed;
|
private bool disposed;
|
||||||
|
|
||||||
public BufferCopyStream(Stream? baseStream, int bufferSize = 4096)
|
public BufferCopyStream(Stream? baseStream, int bufferSize = 4096)
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace CompatBot.Utils;
|
namespace CompatBot.Utils;
|
||||||
|
|
||||||
internal class FixedLengthBuffer<TKey, TValue>: IList<TValue>
|
internal class FixedLengthBuffer<TKey, TValue>: IList<TValue>
|
||||||
where TKey: notnull
|
where TKey: notnull
|
||||||
{
|
{
|
||||||
internal readonly object SyncObj = new();
|
internal readonly Lock SyncObj = new();
|
||||||
|
|
||||||
public FixedLengthBuffer(Func<TValue, TKey> keyGenerator)
|
public FixedLengthBuffer(Func<TValue, TKey> keyGenerator)
|
||||||
{
|
{
|
||||||
|
@ -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
|
# Native libgdiplus dependencies
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<EmitCompilerGeneratedFiles>false</EmitCompilerGeneratedFiles>
|
<EmitCompilerGeneratedFiles>false</EmitCompilerGeneratedFiles>
|
||||||
|
@ -9,15 +9,15 @@ You can read the design and implementation notes by visiting the folders in the
|
|||||||
|
|
||||||
Development Requirements
|
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:
|
* 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)
|
* [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
|
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)
|
* bot needs `dotnet` command to be available (i.e. alias for the Snap package)
|
||||||
* Optionally Google API credentials to access Google Drive:
|
* 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)
|
* Create new project in the [Google Cloud Resource Manager](https://console.developers.google.com/cloud-resource-manager)
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DuoVia.FuzzyStrings" Version="2.1.0" />
|
<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="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||||
<PackageReference Include="NUnit" Version="4.2.2" />
|
<PackageReference Include="NUnit" Version="4.2.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
|
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="NUnit.Analyzers" Version="4.3.0">
|
<PackageReference Include="NUnit.Analyzers" Version="4.4.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
Loading…
Reference in New Issue
Block a user