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
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = 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]
|
[*.cs]
|
||||||
dotnet_diagnostic.MA0004.severity = none
|
dotnet_diagnostic.MA0004.severity = none
|
||||||
file_header_template = Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
dotnet_sort_system_directives_first = true
|
dotnet_sort_system_directives_first = true
|
||||||
dotnet_diagnostic.MA0007.severity = none
|
dotnet_diagnostic.MA0007.severity = none
|
||||||
|
|
|
@ -76,7 +76,7 @@ jobs:
|
||||||
build-docs-container:
|
build-docs-container:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: catthehacker/ubuntu:act-latest@sha256:5f2ff408985b10de9da4a8ea735b7f07d4f98c61608180ebb8964deb37f7580a
|
container: catthehacker/ubuntu:act-latest@sha256:5f2ff408985b10de9da4a8ea735b7f07d4f98c61608180ebb8964deb37f7580a
|
||||||
needs: [docs, preprocess]
|
needs: [ docs, preprocess ]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: https://github.com/actions/checkout@v3
|
uses: https://github.com/actions/checkout@v3
|
||||||
|
@ -120,7 +120,7 @@ jobs:
|
||||||
deploy-wiki:
|
deploy-wiki:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: catthehacker/ubuntu:act-latest@sha256:5f2ff408985b10de9da4a8ea735b7f07d4f98c61608180ebb8964deb37f7580a
|
container: catthehacker/ubuntu:act-latest@sha256:5f2ff408985b10de9da4a8ea735b7f07d4f98c61608180ebb8964deb37f7580a
|
||||||
needs: [build-docs-container, docs, preprocess]
|
needs: [ build-docs-container, docs, preprocess ]
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy Image to CapRrover
|
- name: Deploy Image to CapRrover
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -17,3 +17,8 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: hadolint-docker
|
- id: hadolint-docker
|
||||||
args: [--ignore, SC2086]
|
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 System.Security.Cryptography;
|
||||||
using BenchmarkDotNet.Attributes;
|
using BenchmarkDotNet.Attributes;
|
||||||
|
@ -13,14 +13,14 @@ namespace Benchmarks;
|
||||||
[Config(typeof(GenericConfig))]
|
[Config(typeof(GenericConfig))]
|
||||||
public class Argon2Benchmarks
|
public class Argon2Benchmarks
|
||||||
{
|
{
|
||||||
|
private byte[] _additionalData = null!;
|
||||||
[Params(2, 4)] public int _iterations;
|
[Params(2, 4)] public int _iterations;
|
||||||
|
[Params(16)] public int _length;
|
||||||
[Params(16, 32)] public int _memory;
|
[Params(16, 32)] public int _memory;
|
||||||
[Params(1, 2)] public int _parallelism;
|
[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[] _password = null!;
|
||||||
|
private byte[] _salt = null!;
|
||||||
|
|
||||||
[GlobalSetup]
|
[GlobalSetup]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
|
@ -39,7 +39,7 @@ public class Argon2Benchmarks
|
||||||
MemorySize = 1024 * _memory,
|
MemorySize = 1024 * _memory,
|
||||||
DegreeOfParallelism = _parallelism,
|
DegreeOfParallelism = _parallelism,
|
||||||
AssociatedData = _additionalData,
|
AssociatedData = _additionalData,
|
||||||
Salt = _salt,
|
Salt = _salt
|
||||||
}.GetBytes(_length);
|
}.GetBytes(_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class Argon2Benchmarks
|
||||||
MemorySize = 1024 * _memory,
|
MemorySize = 1024 * _memory,
|
||||||
DegreeOfParallelism = _parallelism,
|
DegreeOfParallelism = _parallelism,
|
||||||
AssociatedData = _additionalData,
|
AssociatedData = _additionalData,
|
||||||
Salt = _salt,
|
Salt = _salt
|
||||||
}.GetBytes(_length);
|
}.GetBytes(_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class Argon2Benchmarks
|
||||||
MemorySize = 1024 * _memory,
|
MemorySize = 1024 * _memory,
|
||||||
DegreeOfParallelism = _parallelism,
|
DegreeOfParallelism = _parallelism,
|
||||||
AssociatedData = _additionalData,
|
AssociatedData = _additionalData,
|
||||||
Salt = _salt,
|
Salt = _salt
|
||||||
}.GetBytes(_length);
|
}.GetBytes(_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public class Argon2Benchmarks
|
||||||
HashLength = _length,
|
HashLength = _length,
|
||||||
Salt = _salt,
|
Salt = _salt,
|
||||||
AssociatedData = _additionalData,
|
AssociatedData = _additionalData,
|
||||||
Password = _password,
|
Password = _password
|
||||||
};
|
};
|
||||||
var argon2 = new Argon2(config);
|
var argon2 = new Argon2(config);
|
||||||
return argon2.Hash().Buffer;
|
return argon2.Hash().Buffer;
|
||||||
|
@ -101,7 +101,7 @@ public class Argon2Benchmarks
|
||||||
HashLength = _length,
|
HashLength = _length,
|
||||||
Salt = _salt,
|
Salt = _salt,
|
||||||
AssociatedData = _additionalData,
|
AssociatedData = _additionalData,
|
||||||
Password = _password,
|
Password = _password
|
||||||
};
|
};
|
||||||
var argon2 = new Argon2(config);
|
var argon2 = new Argon2(config);
|
||||||
return argon2.Hash().Buffer;
|
return argon2.Hash().Buffer;
|
||||||
|
@ -120,7 +120,7 @@ public class Argon2Benchmarks
|
||||||
HashLength = _length,
|
HashLength = _length,
|
||||||
Salt = _salt,
|
Salt = _salt,
|
||||||
AssociatedData = _additionalData,
|
AssociatedData = _additionalData,
|
||||||
Password = _password,
|
Password = _password
|
||||||
};
|
};
|
||||||
var argon2 = new Argon2(config);
|
var argon2 = new Argon2(config);
|
||||||
return argon2.Hash().Buffer;
|
return argon2.Hash().Buffer;
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
<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="BenchmarkDotNet" Version="0.13.12" />
|
<PackageReference Include="BenchmarkDotNet" Version="0.13.12"/>
|
||||||
<PackageReference Include="DotNext.Unsafe" Version="0.14.0" />
|
<PackageReference Include="DotNext.Unsafe" Version="0.14.0"/>
|
||||||
<PackageReference Include="Isopoh.Cryptography.Argon2" Version="2.0.0" />
|
<PackageReference Include="Isopoh.Cryptography.Argon2" Version="2.0.0"/>
|
||||||
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.0" />
|
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.0"/>
|
||||||
<PackageReference Include="Meziantou.Analyzer" Version="2.0.146">
|
<PackageReference Include="Meziantou.Analyzer" Version="2.0.146">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<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.Buffers.Binary;
|
||||||
using System.Security.Cryptography;
|
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.Concurrent;
|
||||||
using System.Collections.Immutable;
|
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.Analysers;
|
||||||
using BenchmarkDotNet.Columns;
|
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 System.Reflection;
|
||||||
using BenchmarkDotNet.Running;
|
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 System.Net.Sockets;
|
||||||
using Continuity.AuthServer.Packets;
|
using Continuity.AuthServer.Packets;
|
||||||
|
@ -12,8 +12,8 @@ namespace Continuity.AuthServer;
|
||||||
|
|
||||||
public class AuthSession : TcpSession
|
public class AuthSession : TcpSession
|
||||||
{
|
{
|
||||||
private readonly ILogger<AuthSession> _logger;
|
|
||||||
private readonly PacketDistributorService<OperationCode, AuthSession> _distributorService;
|
private readonly PacketDistributorService<OperationCode, AuthSession> _distributorService;
|
||||||
|
private readonly ILogger<AuthSession> _logger;
|
||||||
private readonly IMediator _mediator;
|
private readonly IMediator _mediator;
|
||||||
|
|
||||||
public AuthSession(TcpServer
|
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.Security.Cryptography;
|
||||||
using System.Text;
|
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 System.Diagnostics;
|
||||||
using Continuity.AuthServer.Packets;
|
using Continuity.AuthServer.Packets;
|
||||||
|
@ -12,9 +12,8 @@ namespace Continuity.AuthServer.Consumers;
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class PacketConsumer : IConsumer<RawPacket>, IDisposable
|
public class PacketConsumer : IConsumer<RawPacket>, IDisposable
|
||||||
{
|
{
|
||||||
private readonly PacketDistributorService<OperationCode, AuthSession> _distributorService;
|
|
||||||
|
|
||||||
private readonly ActivitySource _activitySource;
|
private readonly ActivitySource _activitySource;
|
||||||
|
private readonly PacketDistributorService<OperationCode, AuthSession> _distributorService;
|
||||||
|
|
||||||
public PacketConsumer(PacketDistributorService<OperationCode, AuthSession> distributorService)
|
public PacketConsumer(PacketDistributorService<OperationCode, AuthSession> distributorService)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,14 +40,14 @@
|
||||||
<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="DotNext" Version="5.3.1" />
|
<PackageReference Include="DotNext" Version="5.3.1"/>
|
||||||
<PackageReference Include="DotNext.IO" Version="5.3.0" />
|
<PackageReference Include="DotNext.IO" Version="5.3.0"/>
|
||||||
<PackageReference Include="DotNext.Metaprogramming" Version="5.3.0" />
|
<PackageReference Include="DotNext.Metaprogramming" Version="5.3.0"/>
|
||||||
<PackageReference Include="DotNext.Threading" Version="5.3.0" />
|
<PackageReference Include="DotNext.Threading" Version="5.3.0"/>
|
||||||
<PackageReference Include="DotNext.Unsafe" Version="5.3.0" />
|
<PackageReference Include="DotNext.Unsafe" Version="5.3.0"/>
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
|
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
|
||||||
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.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">
|
<PackageReference Include="MassTransit.Analyzers" Version="8.1.3">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
@ -60,10 +60,10 @@
|
||||||
<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" 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.Abstractions" Version="8.0.3"/>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" 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.Proxies" Version="8.0.3"/>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
@ -79,23 +79,23 @@
|
||||||
<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="NetCoreServer" Version="8.0.7" />
|
<PackageReference Include="NetCoreServer" Version="8.0.7"/>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2"/>
|
||||||
<PackageReference Include="Npgsql.OpenTelemetry" Version="8.0.2" />
|
<PackageReference Include="Npgsql.OpenTelemetry" Version="8.0.2"/>
|
||||||
<PackageReference Include="Nullable.Extended.Analyzer" Version="1.15.6169">
|
<PackageReference Include="Nullable.Extended.Analyzer" Version="1.15.6169">
|
||||||
<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="OpenTelemetry" Version="1.7.0" />
|
<PackageReference Include="OpenTelemetry" Version="1.7.0"/>
|
||||||
<PackageReference Include="OpenTelemetry.Exporter.Console" 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.OpenTelemetryProtocol" Version="1.7.0"/>
|
||||||
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" 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.Extensions.Hosting" Version="1.7.0"/>
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.10"/>
|
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.10"/>
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.1" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.1"/>
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="1.0.0-alpha.6" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="1.0.0-alpha.6"/>
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.7.0" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.7.0"/>
|
||||||
<PackageReference Include="OpenTelemetry.PersistentStorage.FileSystem" Version="1.0.0"/>
|
<PackageReference Include="OpenTelemetry.PersistentStorage.FileSystem" Version="1.0.0"/>
|
||||||
<PackageReference Include="OpenTelemetry.ResourceDetectors.Container" Version="1.0.0-beta.6"/>
|
<PackageReference Include="OpenTelemetry.ResourceDetectors.Container" Version="1.0.0-beta.6"/>
|
||||||
<PackageReference Include="Serilog.Extensions.Logging.File" Version="3.0.0"/>
|
<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;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
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;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
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;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
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;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
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;
|
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;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
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;
|
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
|
#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
|
#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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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 Continuity.AuthServer.DB.Documents;
|
||||||
using JetBrains.Annotations;
|
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 Continuity.AuthServer.PacketHandlers;
|
||||||
using Microsoft.Extensions.Logging;
|
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 JetBrains.Annotations;
|
||||||
using Microsoft.Extensions.Logging;
|
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 Continuity.AuthServer.DB.Documents;
|
||||||
using Wonderking.Game.Data.Character;
|
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;
|
||||||
using Continuity.AuthServer.DB.Documents;
|
using Continuity.AuthServer.DB.Documents;
|
||||||
|
@ -27,11 +27,12 @@ public partial class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPa
|
||||||
var guildNameResponsePacket = new CharacterSelectionSetGuildNamePacket { GuildNames = Array.Empty<string>() };
|
var guildNameResponsePacket = new CharacterSelectionSetGuildNamePacket { GuildNames = Array.Empty<string>() };
|
||||||
|
|
||||||
var accountExists =
|
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)
|
var amountOfCharacter = await _wonderkingContext.Characters.AsNoTracking().Include(c => c.Account)
|
||||||
.Where(c => c.Account.Id == session.AccountId).Take(3)
|
.Where(c => c.Account.Id == session.AccountId).Take(3)
|
||||||
.CountAsync(cancellationToken: cancellationToken);
|
.CountAsync(cancellationToken);
|
||||||
|
|
||||||
if (!accountExists)
|
if (!accountExists)
|
||||||
{
|
{
|
||||||
|
@ -52,7 +53,7 @@ public partial class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPa
|
||||||
await _wonderkingContext.Characters.AsNoTracking().Include(c => c.Account).Include(c => c.GuildMember)
|
await _wonderkingContext.Characters.AsNoTracking().Include(c => c.Account).Include(c => c.GuildMember)
|
||||||
.ThenInclude(gm => gm.Guild)
|
.ThenInclude(gm => gm.Guild)
|
||||||
.Where(c => c.Account.Id == session.AccountId && c.GuildMember.Guild != null)
|
.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
|
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;
|
||||||
using Continuity.AuthServer.DB.Documents;
|
using Continuity.AuthServer.DB.Documents;
|
||||||
|
@ -30,8 +30,8 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket,
|
||||||
public async Task HandleAsync(CharacterCreationPacket packet, AuthSession session,
|
public async Task HandleAsync(CharacterCreationPacket packet, AuthSession session,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
var account =
|
||||||
var account = await _wonderkingContext.Accounts.FirstOrDefaultAsync(a => a.Id == session.AccountId, cancellationToken: cancellationToken);
|
await _wonderkingContext.Accounts.FirstOrDefaultAsync(a => a.Id == session.AccountId, cancellationToken);
|
||||||
|
|
||||||
if (account is null)
|
if (account is null)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket,
|
||||||
private static Character CreateDefaultCharacter(CharacterCreationPacket packet, Account account,
|
private static Character CreateDefaultCharacter(CharacterCreationPacket packet, Account account,
|
||||||
InventoryItem[] items, JobSpecificMapping firstJobConfig)
|
InventoryItem[] items, JobSpecificMapping firstJobConfig)
|
||||||
{
|
{
|
||||||
return new Character()
|
return new Character
|
||||||
{
|
{
|
||||||
Account = account,
|
Account = account,
|
||||||
MapId = 300,
|
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 Continuity.AuthServer.DB;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
@ -17,10 +17,11 @@ public class CharacterDeletionHandler : IPacketHandler<CharacterDeletePacket, Au
|
||||||
_wonderkingContext = wonderkingContext;
|
_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 &&
|
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 };
|
var response = new CharacterDeleteResponsePacket { HasToBeZero = 0 };
|
||||||
if (character == null)
|
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;
|
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 Continuity.AuthServer.DB;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
@ -22,7 +22,7 @@ public class CharacterNameCheckHandler : IPacketHandler<CharacterNameCheckPacket
|
||||||
{
|
{
|
||||||
var isTaken =
|
var isTaken =
|
||||||
await _wonderkingContext.Characters.AnyAsync(c => c.Name == packet.Name,
|
await _wonderkingContext.Characters.AnyAsync(c => c.Name == packet.Name,
|
||||||
cancellationToken: cancellationToken);
|
cancellationToken);
|
||||||
var responsePacket = new CharacterNameCheckPacketResponse { IsTaken = isTaken };
|
var responsePacket = new CharacterNameCheckPacketResponse { IsTaken = isTaken };
|
||||||
|
|
||||||
await session.SendAsync(responsePacket);
|
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.Diagnostics;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
@ -19,10 +19,10 @@ namespace Continuity.AuthServer.PacketHandlers;
|
||||||
|
|
||||||
public class LoginHandler : IPacketHandler<LoginInfoPacket, AuthSession>
|
public class LoginHandler : IPacketHandler<LoginInfoPacket, AuthSession>
|
||||||
{
|
{
|
||||||
|
private static readonly ActivitySource _activitySource = new(nameof(Server));
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly ILogger<LoginHandler> _logger;
|
private readonly ILogger<LoginHandler> _logger;
|
||||||
private readonly WonderkingContext _wonderkingContext;
|
private readonly WonderkingContext _wonderkingContext;
|
||||||
private static readonly ActivitySource _activitySource = new(nameof(Server));
|
|
||||||
|
|
||||||
public LoginHandler(ILogger<LoginHandler> logger, WonderkingContext wonderkingContext, IConfiguration configuration)
|
public LoginHandler(ILogger<LoginHandler> logger, WonderkingContext wonderkingContext, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
|
@ -35,14 +35,17 @@ public class LoginHandler : IPacketHandler<LoginInfoPacket, AuthSession>
|
||||||
{
|
{
|
||||||
LoginResponseReason loginResponseReason;
|
LoginResponseReason loginResponseReason;
|
||||||
_logger.LoginData(packet.Username, packet.Password);
|
_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 (account == null)
|
||||||
{
|
{
|
||||||
if (_configuration.GetSection("Testing").GetValue<bool>("CreateAccountOnLogin"))
|
if (_configuration.GetSection("Testing").GetValue<bool>("CreateAccountOnLogin"))
|
||||||
{
|
{
|
||||||
loginResponseReason = await CreateAccountOnLoginAsync(packet.Username, packet.Password);
|
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
|
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 MassTransit;
|
||||||
using Wonderking.Packets;
|
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.Net;
|
||||||
using System.Reflection;
|
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 System.Collections.Concurrent;
|
||||||
using Continuity.AuthServer.DB.Documents;
|
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;
|
||||||
using System.Net.Sockets;
|
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;
|
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;
|
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;
|
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;
|
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 System.Diagnostics;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
@ -6,11 +6,9 @@ using JetBrains.Annotations;
|
||||||
namespace Rai.PacketMediator;
|
namespace Rai.PacketMediator;
|
||||||
|
|
||||||
[UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
|
[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,
|
async Task<bool> IPacketHandler<TSession>.TryHandleAsync(IIncomingPacket packet, TSession session,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
@ -20,12 +18,15 @@ public interface IPacketHandler<in TIncomingPacket, in TSession> : IPacketHandle
|
||||||
}
|
}
|
||||||
|
|
||||||
using var activity = new ActivitySource(nameof(PacketMediator)).StartActivity(nameof(HandleAsync));
|
using var activity = new ActivitySource(nameof(PacketMediator)).StartActivity(nameof(HandleAsync));
|
||||||
activity?.AddTag("Handler", this.ToString());
|
activity?.AddTag("Handler", ToString());
|
||||||
activity?.AddTag("Packet", packet.ToString());
|
activity?.AddTag("Packet", packet.ToString());
|
||||||
await HandleAsync(tPacket, session, cancellationToken);
|
await HandleAsync(tPacket, session, cancellationToken);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
|
||||||
|
public Task HandleAsync(TIncomingPacket packet, TSession session, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IPacketHandler<in TSession>
|
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.Concurrent;
|
||||||
using System.Collections.Immutable;
|
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 Channel<ValueTuple<byte[], TPacketIdEnum, TSession>> _channel;
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<TPacketIdEnum, IPacketHandler<TSession>?> _packetHandlersInstantiation;
|
|
||||||
|
|
||||||
private readonly ImmutableDictionary<TPacketIdEnum,
|
private readonly ImmutableDictionary<TPacketIdEnum,
|
||||||
Func<byte[], IIncomingPacket>> _deserializationMap;
|
Func<byte[], IIncomingPacket>> _deserializationMap;
|
||||||
|
|
||||||
public ImmutableDictionary<Type, TPacketIdEnum> PacketIdMap { get; }
|
private readonly ConcurrentDictionary<TPacketIdEnum, IPacketHandler<TSession>?> _packetHandlersInstantiation;
|
||||||
|
|
||||||
public PacketDistributor(IServiceProvider serviceProvider,
|
public PacketDistributor(IServiceProvider serviceProvider,
|
||||||
IEnumerable<Assembly> sourcesContainingPackets, IEnumerable<Assembly> sourcesContainingPacketHandlers)
|
IEnumerable<Assembly> sourcesContainingPackets, IEnumerable<Assembly> sourcesContainingPacketHandlers)
|
||||||
|
@ -37,7 +35,7 @@ public class PacketDistributor<TPacketIdEnum, TSession> where TPacketIdEnum : En
|
||||||
|
|
||||||
var packetHandlers = GetAllPacketHandlersWithId(sourcesContainingPacketHandlers);
|
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);
|
.ToImmutableDictionary(x => x.Type, x => x.PacketId);
|
||||||
|
|
||||||
var tempDeserializationMap =
|
var tempDeserializationMap =
|
||||||
|
@ -69,6 +67,8 @@ public class PacketDistributor<TPacketIdEnum, TSession> where TPacketIdEnum : En
|
||||||
_deserializationMap = tempDeserializationMap.ToImmutableDictionary();
|
_deserializationMap = tempDeserializationMap.ToImmutableDictionary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ImmutableDictionary<Type, TPacketIdEnum> PacketIdMap { get; }
|
||||||
|
|
||||||
private static IEnumerable<KeyValuePair<TPacketIdEnum, Type>> GetAllPackets(
|
private static IEnumerable<KeyValuePair<TPacketIdEnum, Type>> GetAllPackets(
|
||||||
IEnumerable<Assembly> sourcesContainingPackets, Type packetType)
|
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 System.Reflection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
||||||
namespace Rai.PacketMediator;
|
namespace Rai.PacketMediator;
|
||||||
|
|
||||||
public class PacketDistributorService<TPacketIdEnum, TSession> : Microsoft.Extensions.Hosting.IHostedService
|
public class PacketDistributorService<TPacketIdEnum, TSession> : IHostedService
|
||||||
where TPacketIdEnum : Enum
|
where TPacketIdEnum : Enum
|
||||||
{
|
{
|
||||||
private readonly PacketDistributor<TPacketIdEnum, TSession> _packetDistributor;
|
private readonly PacketDistributor<TPacketIdEnum, TSession> _packetDistributor;
|
||||||
|
@ -21,20 +22,20 @@ public class PacketDistributorService<TPacketIdEnum, TSession> : Microsoft.Exten
|
||||||
return _packetDistributor.DequeuePacketAsync(cancellationToken);
|
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)
|
public Task StopAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task AddPacketAsync(byte[] packetData, TPacketIdEnum operationCode, TSession session)
|
||||||
|
{
|
||||||
|
return _packetDistributor.AddPacketAsync(packetData, operationCode, session);
|
||||||
|
}
|
||||||
|
|
||||||
public TPacketIdEnum GetOperationCodeByPacketType(IPacket packet)
|
public TPacketIdEnum GetOperationCodeByPacketType(IPacket packet)
|
||||||
{
|
{
|
||||||
var type = packet.GetType();
|
var type = packet.GetType();
|
||||||
this._packetDistributor.PacketIdMap.TryGetValue(type, out var value);
|
_packetDistributor.PacketIdMap.TryGetValue(type, out var value);
|
||||||
if (value is null)
|
if (value is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException(type.Name);
|
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;
|
namespace Rai.PacketMediator;
|
||||||
|
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DotNext" Version="5.0.1" />
|
<PackageReference Include="DotNext" Version="5.0.1"/>
|
||||||
<PackageReference Include="DotNext.Metaprogramming" Version="5.0.1" />
|
<PackageReference Include="DotNext.Metaprogramming" Version="5.0.1"/>
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
|
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
|
||||||
<PackageReference Include="Meziantou.Analyzer" Version="2.0.139">
|
<PackageReference Include="Meziantou.Analyzer" Version="2.0.139">
|
||||||
<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.Extensions.Hosting.Abstractions" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0"/>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.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">
|
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.8.14">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<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.
|
||||||
|
|
||||||
namespace Wonderking.Game.Data.Character;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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 System.Text.Json.Serialization;
|
||||||
using Wonderking.Game.Data.Item;
|
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;
|
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;
|
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;
|
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 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 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 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 System.Text.Json.Serialization;
|
||||||
using JetBrains.Annotations;
|
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;
|
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)"
|
/* Nicht gemergte Änderung aus Projekt "Wonderking(net7.0)"
|
||||||
Vor:
|
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.Buffers.Binary;
|
||||||
using System.Text;
|
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;
|
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;
|
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 System.Text;
|
||||||
using Rai.PacketMediator;
|
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 System.Text;
|
||||||
using Rai.PacketMediator;
|
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 System.Text;
|
||||||
using Rai.PacketMediator;
|
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 System.Text;
|
||||||
using Rai.PacketMediator;
|
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;
|
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.Buffers.Binary;
|
||||||
using System.Text;
|
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.Buffers.Binary;
|
||||||
using System.Text;
|
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;
|
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;
|
using Rai.PacketMediator;
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ namespace Wonderking.Packets.Outgoing;
|
||||||
public class CharacterNameCheckPacketResponse : IOutgoingPacket
|
public class CharacterNameCheckPacketResponse : IOutgoingPacket
|
||||||
{
|
{
|
||||||
public required bool IsTaken { get; set; }
|
public required bool IsTaken { get; set; }
|
||||||
|
|
||||||
public byte[] Serialize()
|
public byte[] Serialize()
|
||||||
{
|
{
|
||||||
Span<byte> data = stackalloc byte[1];
|
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 System.Text;
|
||||||
using Rai.PacketMediator;
|
using Rai.PacketMediator;
|
||||||
|
@ -9,6 +9,7 @@ namespace Wonderking.Packets.Outgoing;
|
||||||
public class CharacterSelectionSetGuildNamePacket : IOutgoingPacket
|
public class CharacterSelectionSetGuildNamePacket : IOutgoingPacket
|
||||||
{
|
{
|
||||||
public required string[] GuildNames { get; set; }
|
public required string[] GuildNames { get; set; }
|
||||||
|
|
||||||
public byte[] Serialize()
|
public byte[] Serialize()
|
||||||
{
|
{
|
||||||
Span<byte> data = stackalloc byte[1 + (1 + 16 + 1) * GuildNames.Length];
|
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 System.Text.Json.Serialization;
|
||||||
using JetBrains.Annotations;
|
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;
|
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 JetBrains.Annotations;
|
||||||
using Microsoft.EntityFrameworkCore;
|
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;
|
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;
|
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 System.Buffers.Binary;
|
||||||
using Rai.PacketMediator;
|
using Rai.PacketMediator;
|
||||||
|
@ -14,6 +14,7 @@ public class LoginResponsePacket : IOutgoingPacket
|
||||||
public required bool IsGameMaster { get; set; }
|
public required bool IsGameMaster { get; set; }
|
||||||
|
|
||||||
public required ServerChannelData[] ChannelData { get; set; }
|
public required ServerChannelData[] ChannelData { get; set; }
|
||||||
|
|
||||||
public byte[] Serialize()
|
public byte[] Serialize()
|
||||||
{
|
{
|
||||||
const int sizeOfServerChannelData = 5;
|
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;
|
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;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<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.Abstractions" Version="8.0.3" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.3"/>
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.9.28">
|
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.9.28">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
@ -42,6 +42,6 @@
|
||||||
<Folder Include="Game\Writer\"/>
|
<Folder Include="Game\Writer\"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Rai.PacketMediator\Rai.PacketMediator.csproj" />
|
<ProjectReference Include="..\Rai.PacketMediator\Rai.PacketMediator.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Reference in a new issue