chore: file header adjustment
This commit is contained in:
parent
6147a76d16
commit
7ac4c8c0ef
95 changed files with 281 additions and 264 deletions
|
@ -23,10 +23,13 @@ indent_style = space
|
|||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
file_header_template = Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
[*.(yaml|yml)]
|
||||
indent_size = 2
|
||||
|
||||
[*.cs]
|
||||
dotnet_diagnostic.MA0004.severity = none
|
||||
file_header_template = Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
indent_size = 4
|
||||
dotnet_sort_system_directives_first = true
|
||||
dotnet_diagnostic.MA0007.severity = none
|
||||
|
|
|
@ -6,8 +6,8 @@ on:
|
|||
- develop
|
||||
- master
|
||||
paths:
|
||||
- Wiki/**
|
||||
- Wiki.Dockerfile
|
||||
- Wiki/**
|
||||
- Wiki.Dockerfile
|
||||
|
||||
env:
|
||||
# Name of module and id separated by a slash
|
||||
|
@ -25,103 +25,103 @@ jobs:
|
|||
outputs:
|
||||
sanitized_branch_name: ${{ steps.sanitize.outputs.sanitized_branch_name }}
|
||||
steps:
|
||||
- name: Sanitize branch name
|
||||
id: sanitize
|
||||
run: echo "::set-output name=sanitized_branch_name::$(echo ${{ github.ref_name }} | sed 's/\//-/g')"
|
||||
- name: Sanitize branch name
|
||||
id: sanitize
|
||||
run: echo "::set-output name=sanitized_branch_name::$(echo ${{ github.ref_name }} | sed 's/\//-/g')"
|
||||
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
container: registry.jetbrains.team/p/writerside/builder/writerside-builder:${{env.DOCKER_VERSION}}
|
||||
steps:
|
||||
- name: Install basic dependencies
|
||||
run: |
|
||||
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
|
||||
echo "::add-path::$HOME/.nvm"
|
||||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
nvm install 18
|
||||
nvm use 18
|
||||
echo "::add-path::$(dirname $(which npm))"
|
||||
nvm --version
|
||||
- name: Check Node.js version
|
||||
run: |
|
||||
node -v
|
||||
npm -v
|
||||
- name: Checkout repository
|
||||
uses: https://github.com/actions/checkout@v3
|
||||
- name: Build docs
|
||||
run: |
|
||||
set -e
|
||||
export DISPLAY=:99
|
||||
Xvfb :99 &
|
||||
/opt/builder/bin/idea.sh helpbuilderinspect -source-dir . -product ${{env.INSTANCE}} -output-dir artifacts/ || true
|
||||
echo "Test existing of ${{ env.ARTIFACT }} artifact"
|
||||
test -e artifacts/${{ env.ARTIFACT }}
|
||||
- name: rename artifact
|
||||
run: |
|
||||
mv artifacts/${{ env.ARTIFACT }} artifacts/wiki.zip
|
||||
- name: Upload documentation
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: wiki.zip
|
||||
path: artifacts/wiki.zip
|
||||
retention-days: 14
|
||||
- name: Upload algolia-indexes
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: algolia-indexes.zip
|
||||
path: artifacts/${{ env.ALGOLIA_ARTIFACT }}
|
||||
retention-days: 14
|
||||
- name: Install basic dependencies
|
||||
run: |
|
||||
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
|
||||
echo "::add-path::$HOME/.nvm"
|
||||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
nvm install 18
|
||||
nvm use 18
|
||||
echo "::add-path::$(dirname $(which npm))"
|
||||
nvm --version
|
||||
- name: Check Node.js version
|
||||
run: |
|
||||
node -v
|
||||
npm -v
|
||||
- name: Checkout repository
|
||||
uses: https://github.com/actions/checkout@v3
|
||||
- name: Build docs
|
||||
run: |
|
||||
set -e
|
||||
export DISPLAY=:99
|
||||
Xvfb :99 &
|
||||
/opt/builder/bin/idea.sh helpbuilderinspect -source-dir . -product ${{env.INSTANCE}} -output-dir artifacts/ || true
|
||||
echo "Test existing of ${{ env.ARTIFACT }} artifact"
|
||||
test -e artifacts/${{ env.ARTIFACT }}
|
||||
- name: rename artifact
|
||||
run: |
|
||||
mv artifacts/${{ env.ARTIFACT }} artifacts/wiki.zip
|
||||
- name: Upload documentation
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: wiki.zip
|
||||
path: artifacts/wiki.zip
|
||||
retention-days: 14
|
||||
- name: Upload algolia-indexes
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: algolia-indexes.zip
|
||||
path: artifacts/${{ env.ALGOLIA_ARTIFACT }}
|
||||
retention-days: 14
|
||||
|
||||
build-docs-container:
|
||||
runs-on: ubuntu-latest
|
||||
container: catthehacker/ubuntu:act-latest@sha256:5f2ff408985b10de9da4a8ea735b7f07d4f98c61608180ebb8964deb37f7580a
|
||||
needs: [docs, preprocess]
|
||||
needs: [ docs, preprocess ]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: https://github.com/actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ github.server_url }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
- name: Retrieve docs artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: wiki.zip
|
||||
path: ${{ github.workspace }}
|
||||
- name: Unzip wiki.zip into .public
|
||||
run: |
|
||||
mkdir .public
|
||||
unzip -jo -qq ./wiki.zip/wiki.zip -d .public
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Wiki.Dockerfile
|
||||
push: true
|
||||
tags: forge.rainote.dev/${{ github.repository }}:${{ needs.preprocess.outputs.sanitized_branch_name }}-wiki
|
||||
platforms: linux/amd64,linux/arm64
|
||||
- name: Build and push to latest
|
||||
if: github.ref_name == 'master'
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Wiki.Dockerfile
|
||||
push: true
|
||||
tags: forge.rainote.dev/${{ github.repository }}:latest-wiki
|
||||
platforms: linux/amd64, linux/arm64
|
||||
- name: Checkout repository
|
||||
uses: https://github.com/actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ github.server_url }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
- name: Retrieve docs artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: wiki.zip
|
||||
path: ${{ github.workspace }}
|
||||
- name: Unzip wiki.zip into .public
|
||||
run: |
|
||||
mkdir .public
|
||||
unzip -jo -qq ./wiki.zip/wiki.zip -d .public
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Wiki.Dockerfile
|
||||
push: true
|
||||
tags: forge.rainote.dev/${{ github.repository }}:${{ needs.preprocess.outputs.sanitized_branch_name }}-wiki
|
||||
platforms: linux/amd64,linux/arm64
|
||||
- name: Build and push to latest
|
||||
if: github.ref_name == 'master'
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Wiki.Dockerfile
|
||||
push: true
|
||||
tags: forge.rainote.dev/${{ github.repository }}:latest-wiki
|
||||
platforms: linux/amd64, linux/arm64
|
||||
|
||||
deploy-wiki:
|
||||
runs-on: ubuntu-latest
|
||||
container: catthehacker/ubuntu:act-latest@sha256:5f2ff408985b10de9da4a8ea735b7f07d4f98c61608180ebb8964deb37f7580a
|
||||
needs: [build-docs-container, docs, preprocess]
|
||||
needs: [ build-docs-container, docs, preprocess ]
|
||||
steps:
|
||||
- name: Deploy Image to CapRrover
|
||||
run: |
|
||||
docker run caprover/cli-caprover:2.2.3 caprover deploy --caproverUrl ${{ secrets.CAPROVER_SERVER }} --appToken ${{ secrets.WIKI_APP_TOKEN }} --imageName forge.rainote.dev/${{ github.repository }}:${{ needs.preprocess.outputs.sanitized_branch_name }}-wiki -a ${{ secrets.WIKI_APP_NAME }}
|
||||
- name: Deploy Image to CapRrover
|
||||
run: |
|
||||
docker run caprover/cli-caprover:2.2.3 caprover deploy --caproverUrl ${{ secrets.CAPROVER_SERVER }} --appToken ${{ secrets.WIKI_APP_TOKEN }} --imageName forge.rainote.dev/${{ github.repository }}:${{ needs.preprocess.outputs.sanitized_branch_name }}-wiki -a ${{ secrets.WIKI_APP_NAME }}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
#Use dotnet format already installed on your machine
|
||||
#Use dotnet format already installed on your machine
|
||||
- id: dotnet-format
|
||||
name: dotnet-format
|
||||
language: system
|
||||
|
@ -17,3 +17,8 @@ repos:
|
|||
hooks:
|
||||
- id: hadolint-docker
|
||||
args: [--ignore, SC2086]
|
||||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
||||
rev: v2.12.0
|
||||
hooks:
|
||||
- id: pretty-format-yaml
|
||||
args: [--autofix, --indent, '2']
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Security.Cryptography;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
|
@ -13,14 +13,14 @@ namespace Benchmarks;
|
|||
[Config(typeof(GenericConfig))]
|
||||
public class Argon2Benchmarks
|
||||
{
|
||||
private byte[] _additionalData = null!;
|
||||
[Params(2, 4)] public int _iterations;
|
||||
[Params(16)] public int _length;
|
||||
[Params(16, 32)] public int _memory;
|
||||
[Params(1, 2)] public int _parallelism;
|
||||
private byte[] _salt = null!;
|
||||
private byte[] _additionalData = null!;
|
||||
[Params(16)] public int _length;
|
||||
|
||||
private byte[] _password = null!;
|
||||
private byte[] _salt = null!;
|
||||
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
|
@ -39,7 +39,7 @@ public class Argon2Benchmarks
|
|||
MemorySize = 1024 * _memory,
|
||||
DegreeOfParallelism = _parallelism,
|
||||
AssociatedData = _additionalData,
|
||||
Salt = _salt,
|
||||
Salt = _salt
|
||||
}.GetBytes(_length);
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class Argon2Benchmarks
|
|||
MemorySize = 1024 * _memory,
|
||||
DegreeOfParallelism = _parallelism,
|
||||
AssociatedData = _additionalData,
|
||||
Salt = _salt,
|
||||
Salt = _salt
|
||||
}.GetBytes(_length);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class Argon2Benchmarks
|
|||
MemorySize = 1024 * _memory,
|
||||
DegreeOfParallelism = _parallelism,
|
||||
AssociatedData = _additionalData,
|
||||
Salt = _salt,
|
||||
Salt = _salt
|
||||
}.GetBytes(_length);
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class Argon2Benchmarks
|
|||
HashLength = _length,
|
||||
Salt = _salt,
|
||||
AssociatedData = _additionalData,
|
||||
Password = _password,
|
||||
Password = _password
|
||||
};
|
||||
var argon2 = new Argon2(config);
|
||||
return argon2.Hash().Buffer;
|
||||
|
@ -101,7 +101,7 @@ public class Argon2Benchmarks
|
|||
HashLength = _length,
|
||||
Salt = _salt,
|
||||
AssociatedData = _additionalData,
|
||||
Password = _password,
|
||||
Password = _password
|
||||
};
|
||||
var argon2 = new Argon2(config);
|
||||
return argon2.Hash().Buffer;
|
||||
|
@ -120,7 +120,7 @@ public class Argon2Benchmarks
|
|||
HashLength = _length,
|
||||
Salt = _salt,
|
||||
AssociatedData = _additionalData,
|
||||
Password = _password,
|
||||
Password = _password
|
||||
};
|
||||
var argon2 = new Argon2(config);
|
||||
return argon2.Hash().Buffer;
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
|
||||
<PackageReference Include="DotNext.Unsafe" Version="0.14.0" />
|
||||
<PackageReference Include="Isopoh.Cryptography.Argon2" Version="2.0.0" />
|
||||
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.0" />
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.13.12"/>
|
||||
<PackageReference Include="DotNext.Unsafe" Version="0.14.0"/>
|
||||
<PackageReference Include="Isopoh.Cryptography.Argon2" Version="2.0.0"/>
|
||||
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.0"/>
|
||||
<PackageReference Include="Meziantou.Analyzer" Version="2.0.146">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Buffers.Binary;
|
||||
using System.Security.Cryptography;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Immutable;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using BenchmarkDotNet.Analysers;
|
||||
using BenchmarkDotNet.Columns;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Reflection;
|
||||
using BenchmarkDotNet.Running;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Net.Sockets;
|
||||
using Continuity.AuthServer.Packets;
|
||||
|
@ -12,8 +12,8 @@ namespace Continuity.AuthServer;
|
|||
|
||||
public class AuthSession : TcpSession
|
||||
{
|
||||
private readonly ILogger<AuthSession> _logger;
|
||||
private readonly PacketDistributorService<OperationCode, AuthSession> _distributorService;
|
||||
private readonly ILogger<AuthSession> _logger;
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public AuthSession(TcpServer
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Diagnostics;
|
||||
using Continuity.AuthServer.Packets;
|
||||
|
@ -12,9 +12,8 @@ namespace Continuity.AuthServer.Consumers;
|
|||
[UsedImplicitly]
|
||||
public class PacketConsumer : IConsumer<RawPacket>, IDisposable
|
||||
{
|
||||
private readonly PacketDistributorService<OperationCode, AuthSession> _distributorService;
|
||||
|
||||
private readonly ActivitySource _activitySource;
|
||||
private readonly PacketDistributorService<OperationCode, AuthSession> _distributorService;
|
||||
|
||||
public PacketConsumer(PacketDistributorService<OperationCode, AuthSession> distributorService)
|
||||
{
|
||||
|
|
|
@ -40,14 +40,14 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="DotNext" Version="5.3.1" />
|
||||
<PackageReference Include="DotNext.IO" Version="5.3.0" />
|
||||
<PackageReference Include="DotNext.Metaprogramming" Version="5.3.0" />
|
||||
<PackageReference Include="DotNext.Threading" Version="5.3.0" />
|
||||
<PackageReference Include="DotNext.Unsafe" Version="5.3.0" />
|
||||
<PackageReference Include="DotNext" Version="5.3.1"/>
|
||||
<PackageReference Include="DotNext.IO" Version="5.3.0"/>
|
||||
<PackageReference Include="DotNext.Metaprogramming" Version="5.3.0"/>
|
||||
<PackageReference Include="DotNext.Threading" Version="5.3.0"/>
|
||||
<PackageReference Include="DotNext.Unsafe" Version="5.3.0"/>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
|
||||
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.0"/>
|
||||
<PackageReference Include="MassTransit" Version="8.1.3" />
|
||||
<PackageReference Include="MassTransit" Version="8.1.3"/>
|
||||
<PackageReference Include="MassTransit.Analyzers" Version="8.1.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
@ -60,10 +60,10 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.3"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.3"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.3"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.3"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
@ -79,23 +79,23 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NetCoreServer" Version="8.0.7" />
|
||||
<PackageReference Include="NetCoreServer" Version="8.0.7"/>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
|
||||
<PackageReference Include="Npgsql.OpenTelemetry" Version="8.0.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2"/>
|
||||
<PackageReference Include="Npgsql.OpenTelemetry" Version="8.0.2"/>
|
||||
<PackageReference Include="Nullable.Extended.Analyzer" Version="1.15.6169">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="OpenTelemetry" Version="1.7.0" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.7.0" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.7.0" />
|
||||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0" />
|
||||
<PackageReference Include="OpenTelemetry" Version="1.7.0"/>
|
||||
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.7.0"/>
|
||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0"/>
|
||||
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.7.0"/>
|
||||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0"/>
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.10"/>
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.1" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="1.0.0-alpha.6" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.7.0" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.1"/>
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="1.0.0-alpha.6"/>
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.7.0"/>
|
||||
<PackageReference Include="OpenTelemetry.PersistentStorage.FileSystem" Version="1.0.0"/>
|
||||
<PackageReference Include="OpenTelemetry.ResourceDetectors.Container" Version="1.0.0-beta.6"/>
|
||||
<PackageReference Include="Serilog.Extensions.Logging.File" Version="3.0.0"/>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
namespace Continuity.AuthServer.DB.Documents;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
namespace Continuity.AuthServer.DB.Documents;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
#nullable disable
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
#nullable disable
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Continuity.AuthServer.DB.Documents;
|
||||
using JetBrains.Annotations;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Continuity.AuthServer.PacketHandlers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Continuity.AuthServer.DB.Documents;
|
||||
using Wonderking.Game.Data.Character;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Continuity.AuthServer.DB;
|
||||
using Continuity.AuthServer.DB.Documents;
|
||||
|
@ -27,11 +27,12 @@ public partial class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPa
|
|||
var guildNameResponsePacket = new CharacterSelectionSetGuildNamePacket { GuildNames = Array.Empty<string>() };
|
||||
|
||||
var accountExists =
|
||||
await _wonderkingContext.Accounts.AsNoTracking().AnyAsync(a => a.Id == session.AccountId, cancellationToken: cancellationToken);
|
||||
await _wonderkingContext.Accounts.AsNoTracking()
|
||||
.AnyAsync(a => a.Id == session.AccountId, cancellationToken);
|
||||
|
||||
var amountOfCharacter = await _wonderkingContext.Characters.AsNoTracking().Include(c => c.Account)
|
||||
.Where(c => c.Account.Id == session.AccountId).Take(3)
|
||||
.CountAsync(cancellationToken: cancellationToken);
|
||||
.CountAsync(cancellationToken);
|
||||
|
||||
if (!accountExists)
|
||||
{
|
||||
|
@ -52,7 +53,7 @@ public partial class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPa
|
|||
await _wonderkingContext.Characters.AsNoTracking().Include(c => c.Account).Include(c => c.GuildMember)
|
||||
.ThenInclude(gm => gm.Guild)
|
||||
.Where(c => c.Account.Id == session.AccountId && c.GuildMember.Guild != null)
|
||||
.Select(c => c.GuildMember.Guild.Name).Take(3).ToArrayAsync(cancellationToken: cancellationToken);
|
||||
.Select(c => c.GuildMember.Guild.Name).Take(3).ToArrayAsync(cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Continuity.AuthServer.DB;
|
||||
using Continuity.AuthServer.DB.Documents;
|
||||
|
@ -30,8 +30,8 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket,
|
|||
public async Task HandleAsync(CharacterCreationPacket packet, AuthSession session,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
var account = await _wonderkingContext.Accounts.FirstOrDefaultAsync(a => a.Id == session.AccountId, cancellationToken: cancellationToken);
|
||||
var account =
|
||||
await _wonderkingContext.Accounts.FirstOrDefaultAsync(a => a.Id == session.AccountId, cancellationToken);
|
||||
|
||||
if (account is null)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket,
|
|||
private static Character CreateDefaultCharacter(CharacterCreationPacket packet, Account account,
|
||||
InventoryItem[] items, JobSpecificMapping firstJobConfig)
|
||||
{
|
||||
return new Character()
|
||||
return new Character
|
||||
{
|
||||
Account = account,
|
||||
MapId = 300,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Continuity.AuthServer.DB;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -17,10 +17,11 @@ public class CharacterDeletionHandler : IPacketHandler<CharacterDeletePacket, Au
|
|||
_wonderkingContext = wonderkingContext;
|
||||
}
|
||||
|
||||
public async Task HandleAsync(CharacterDeletePacket packet, AuthSession session, CancellationToken cancellationToken)
|
||||
public async Task HandleAsync(CharacterDeletePacket packet, AuthSession session,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var character = await _wonderkingContext.Characters.FirstOrDefaultAsync(x => x.Name == packet.Name &&
|
||||
x.Account.Id == session.AccountId, cancellationToken: cancellationToken);
|
||||
x.Account.Id == session.AccountId, cancellationToken);
|
||||
|
||||
var response = new CharacterDeleteResponsePacket { HasToBeZero = 0 };
|
||||
if (character == null)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Continuity.AuthServer.DB;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -22,7 +22,7 @@ public class CharacterNameCheckHandler : IPacketHandler<CharacterNameCheckPacket
|
|||
{
|
||||
var isTaken =
|
||||
await _wonderkingContext.Characters.AnyAsync(c => c.Name == packet.Name,
|
||||
cancellationToken: cancellationToken);
|
||||
cancellationToken);
|
||||
var responsePacket = new CharacterNameCheckPacketResponse { IsTaken = isTaken };
|
||||
|
||||
await session.SendAsync(responsePacket);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Security.Cryptography;
|
||||
|
@ -19,10 +19,10 @@ namespace Continuity.AuthServer.PacketHandlers;
|
|||
|
||||
public class LoginHandler : IPacketHandler<LoginInfoPacket, AuthSession>
|
||||
{
|
||||
private static readonly ActivitySource _activitySource = new(nameof(Server));
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ILogger<LoginHandler> _logger;
|
||||
private readonly WonderkingContext _wonderkingContext;
|
||||
private static readonly ActivitySource _activitySource = new(nameof(Server));
|
||||
|
||||
public LoginHandler(ILogger<LoginHandler> logger, WonderkingContext wonderkingContext, IConfiguration configuration)
|
||||
{
|
||||
|
@ -35,14 +35,17 @@ public class LoginHandler : IPacketHandler<LoginInfoPacket, AuthSession>
|
|||
{
|
||||
LoginResponseReason loginResponseReason;
|
||||
_logger.LoginData(packet.Username, packet.Password);
|
||||
var account = await _wonderkingContext.Accounts.FirstOrDefaultAsync(a => a.Username == packet.Username, cancellationToken: cancellationToken);
|
||||
var account =
|
||||
await _wonderkingContext.Accounts.FirstOrDefaultAsync(a => a.Username == packet.Username,
|
||||
cancellationToken);
|
||||
|
||||
if (account == null)
|
||||
{
|
||||
if (_configuration.GetSection("Testing").GetValue<bool>("CreateAccountOnLogin"))
|
||||
{
|
||||
loginResponseReason = await CreateAccountOnLoginAsync(packet.Username, packet.Password);
|
||||
account = await _wonderkingContext.Accounts.FirstOrDefaultAsync(a => a.Username == packet.Username, cancellationToken: cancellationToken);
|
||||
account = await _wonderkingContext.Accounts.FirstOrDefaultAsync(a => a.Username == packet.Username,
|
||||
cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using MassTransit;
|
||||
using Wonderking.Packets;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
using Continuity.AuthServer.DB.Documents;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using JetBrains.Annotations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using JetBrains.Annotations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using JetBrains.Annotations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
namespace Rai.PacketMediator;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Diagnostics;
|
||||
using JetBrains.Annotations;
|
||||
|
@ -6,11 +6,9 @@ using JetBrains.Annotations;
|
|||
namespace Rai.PacketMediator;
|
||||
|
||||
[UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
|
||||
public interface IPacketHandler<in TIncomingPacket, in TSession> : IPacketHandler<TSession> where TIncomingPacket : IIncomingPacket
|
||||
public interface IPacketHandler<in TIncomingPacket, in TSession> : IPacketHandler<TSession>
|
||||
where TIncomingPacket : IIncomingPacket
|
||||
{
|
||||
[UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
|
||||
public Task HandleAsync(TIncomingPacket packet, TSession session, CancellationToken cancellationToken);
|
||||
|
||||
async Task<bool> IPacketHandler<TSession>.TryHandleAsync(IIncomingPacket packet, TSession session,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
|
@ -20,12 +18,15 @@ public interface IPacketHandler<in TIncomingPacket, in TSession> : IPacketHandle
|
|||
}
|
||||
|
||||
using var activity = new ActivitySource(nameof(PacketMediator)).StartActivity(nameof(HandleAsync));
|
||||
activity?.AddTag("Handler", this.ToString());
|
||||
activity?.AddTag("Handler", ToString());
|
||||
activity?.AddTag("Packet", packet.ToString());
|
||||
await HandleAsync(tPacket, session, cancellationToken);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
|
||||
public Task HandleAsync(TIncomingPacket packet, TSession session, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public interface IPacketHandler<in TSession>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Immutable;
|
||||
|
@ -15,12 +15,10 @@ public class PacketDistributor<TPacketIdEnum, TSession> where TPacketIdEnum : En
|
|||
{
|
||||
private readonly Channel<ValueTuple<byte[], TPacketIdEnum, TSession>> _channel;
|
||||
|
||||
private readonly ConcurrentDictionary<TPacketIdEnum, IPacketHandler<TSession>?> _packetHandlersInstantiation;
|
||||
|
||||
private readonly ImmutableDictionary<TPacketIdEnum,
|
||||
Func<byte[], IIncomingPacket>> _deserializationMap;
|
||||
|
||||
public ImmutableDictionary<Type, TPacketIdEnum> PacketIdMap { get; }
|
||||
private readonly ConcurrentDictionary<TPacketIdEnum, IPacketHandler<TSession>?> _packetHandlersInstantiation;
|
||||
|
||||
public PacketDistributor(IServiceProvider serviceProvider,
|
||||
IEnumerable<Assembly> sourcesContainingPackets, IEnumerable<Assembly> sourcesContainingPacketHandlers)
|
||||
|
@ -37,7 +35,7 @@ public class PacketDistributor<TPacketIdEnum, TSession> where TPacketIdEnum : En
|
|||
|
||||
var packetHandlers = GetAllPacketHandlersWithId(sourcesContainingPacketHandlers);
|
||||
|
||||
this.PacketIdMap = allOutgoingPackets.Select(x => new { PacketId = x.Key, Type = x.Value })
|
||||
PacketIdMap = allOutgoingPackets.Select(x => new { PacketId = x.Key, Type = x.Value })
|
||||
.ToImmutableDictionary(x => x.Type, x => x.PacketId);
|
||||
|
||||
var tempDeserializationMap =
|
||||
|
@ -69,6 +67,8 @@ public class PacketDistributor<TPacketIdEnum, TSession> where TPacketIdEnum : En
|
|||
_deserializationMap = tempDeserializationMap.ToImmutableDictionary();
|
||||
}
|
||||
|
||||
public ImmutableDictionary<Type, TPacketIdEnum> PacketIdMap { get; }
|
||||
|
||||
private static IEnumerable<KeyValuePair<TPacketIdEnum, Type>> GetAllPackets(
|
||||
IEnumerable<Assembly> sourcesContainingPackets, Type packetType)
|
||||
{
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Reflection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Rai.PacketMediator;
|
||||
|
||||
public class PacketDistributorService<TPacketIdEnum, TSession> : Microsoft.Extensions.Hosting.IHostedService
|
||||
public class PacketDistributorService<TPacketIdEnum, TSession> : IHostedService
|
||||
where TPacketIdEnum : Enum
|
||||
{
|
||||
private readonly PacketDistributor<TPacketIdEnum, TSession> _packetDistributor;
|
||||
|
@ -21,20 +22,20 @@ public class PacketDistributorService<TPacketIdEnum, TSession> : Microsoft.Exten
|
|||
return _packetDistributor.DequeuePacketAsync(cancellationToken);
|
||||
}
|
||||
|
||||
public Task AddPacketAsync(byte[] packetData, TPacketIdEnum operationCode, TSession session)
|
||||
{
|
||||
return this._packetDistributor.AddPacketAsync(packetData, operationCode, session);
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task AddPacketAsync(byte[] packetData, TPacketIdEnum operationCode, TSession session)
|
||||
{
|
||||
return _packetDistributor.AddPacketAsync(packetData, operationCode, session);
|
||||
}
|
||||
|
||||
public TPacketIdEnum GetOperationCodeByPacketType(IPacket packet)
|
||||
{
|
||||
var type = packet.GetType();
|
||||
this._packetDistributor.PacketIdMap.TryGetValue(type, out var value);
|
||||
_packetDistributor.PacketIdMap.TryGetValue(type, out var value);
|
||||
if (value is null)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(type.Name);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
namespace Rai.PacketMediator;
|
||||
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotNext" Version="5.0.1" />
|
||||
<PackageReference Include="DotNext.Metaprogramming" Version="5.0.1" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
|
||||
<PackageReference Include="Meziantou.Analyzer" Version="2.0.139">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.8.14">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotNext" Version="5.0.1"/>
|
||||
<PackageReference Include="DotNext.Metaprogramming" Version="5.0.1"/>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
|
||||
<PackageReference Include="Meziantou.Analyzer" Version="2.0.139">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0"/>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.8.14">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
namespace Wonderking.Game.Data.Character;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
namespace Wonderking.Game.Data.Character;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
namespace Wonderking.Game.Data.Item;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using Wonderking.Game.Data.Item;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using JetBrains.Annotations;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using JetBrains.Annotations;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
/* Nicht gemergte Änderung aus Projekt "Wonderking(net7.0)"
|
||||
Vor:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Buffers.Binary;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Wonderking.Game.Data.Item;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Rai.PacketMediator;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text;
|
||||
using Rai.PacketMediator;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text;
|
||||
using Rai.PacketMediator;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text;
|
||||
using Rai.PacketMediator;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text;
|
||||
using Rai.PacketMediator;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
namespace Wonderking.Packets;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Buffers.Binary;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Buffers.Binary;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Rai.PacketMediator;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Rai.PacketMediator;
|
||||
|
||||
|
@ -8,6 +8,7 @@ namespace Wonderking.Packets.Outgoing;
|
|||
public class CharacterNameCheckPacketResponse : IOutgoingPacket
|
||||
{
|
||||
public required bool IsTaken { get; set; }
|
||||
|
||||
public byte[] Serialize()
|
||||
{
|
||||
Span<byte> data = stackalloc byte[1];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text;
|
||||
using Rai.PacketMediator;
|
||||
|
@ -9,6 +9,7 @@ namespace Wonderking.Packets.Outgoing;
|
|||
public class CharacterSelectionSetGuildNamePacket : IOutgoingPacket
|
||||
{
|
||||
public required string[] GuildNames { get; set; }
|
||||
|
||||
public byte[] Serialize()
|
||||
{
|
||||
Span<byte> data = stackalloc byte[1 + (1 + 16 + 1) * GuildNames.Length];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using JetBrains.Annotations;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Wonderking.Game.Data.Character;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
namespace Wonderking.Packets.Outgoing.Data;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Buffers.Binary;
|
||||
using Rai.PacketMediator;
|
||||
|
@ -14,6 +14,7 @@ public class LoginResponsePacket : IOutgoingPacket
|
|||
public required bool IsGameMaster { get; set; }
|
||||
|
||||
public required ServerChannelData[] ChannelData { get; set; }
|
||||
|
||||
public byte[] Serialize()
|
||||
{
|
||||
const int sizeOfServerChannelData = 5;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using Rai.PacketMediator;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.3"/>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.9.28">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
@ -42,6 +42,6 @@
|
|||
<Folder Include="Game\Writer\"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Rai.PacketMediator\Rai.PacketMediator.csproj" />
|
||||
<ProjectReference Include="..\Rai.PacketMediator\Rai.PacketMediator.csproj"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in a new issue