diff --git a/.editorconfig b/.editorconfig
index 26747b6..4d9252b 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -414,6 +414,9 @@ dotnet_naming_rule.parameters_rule.symbols = parameters_group
dotnet_naming_rule.parameters_rule.style = camel_case_style
dotnet_naming_rule.parameters_rule.severity = warning
+# Disable warnings for using LoggerMessage delegates
+dotnet_diagnostic.CA1848.severity = none
+
##########################################
# License
##########################################
diff --git a/Benchmarks/BinaryConversionBenchmarks.cs b/Benchmarks/BinaryConversionBenchmarks.cs
index 88603f4..44f9c1a 100644
--- a/Benchmarks/BinaryConversionBenchmarks.cs
+++ b/Benchmarks/BinaryConversionBenchmarks.cs
@@ -1,4 +1,4 @@
-namespace Benchmarks;
+namespace Benchmarks;
using System.Security.Cryptography;
using BenchmarkDotNet.Attributes;
diff --git a/Benchmarks/Program.cs b/Benchmarks/Program.cs
index d25b2b7..ae6c326 100644
--- a/Benchmarks/Program.cs
+++ b/Benchmarks/Program.cs
@@ -1,4 +1,4 @@
-using System.Reflection;
+using System.Reflection;
using BenchmarkDotNet.Running;
BenchmarkRunner.Run(Assembly.GetExecutingAssembly());
diff --git a/Server/ChannelSession.cs b/Server/ChannelSession.cs
index 10ba237..41e6ee8 100644
--- a/Server/ChannelSession.cs
+++ b/Server/ChannelSession.cs
@@ -1,4 +1,4 @@
-namespace Server;
+namespace Server;
using System.Security.Cryptography;
using System.Text;
@@ -30,7 +30,9 @@ public class ChannelSession : TcpSession
aes.Key = Key;
aes.IV = Iv;
aes.Padding = PaddingMode.None;
+#pragma warning disable SEC0026
aes.Mode = CipherMode.ECB;
+#pragma warning restore SEC0026
this.decryptor = aes.CreateDecryptor(aes.Key, aes.IV);
this.encryptor = aes.CreateEncryptor(aes.Key, aes.IV);
diff --git a/Server/Consumers/PacketConsumer.cs b/Server/Consumers/PacketConsumer.cs
index c938cd3..44c80cf 100644
--- a/Server/Consumers/PacketConsumer.cs
+++ b/Server/Consumers/PacketConsumer.cs
@@ -1,4 +1,4 @@
-namespace Server.Consumers;
+namespace Server.Consumers;
using MassTransit;
using Packets;
diff --git a/Server/DB/Documents/Account.cs b/Server/DB/Documents/Account.cs
index b360b74..7d66d36 100644
--- a/Server/DB/Documents/Account.cs
+++ b/Server/DB/Documents/Account.cs
@@ -1,4 +1,4 @@
-namespace Server.DB.Documents;
+namespace Server.DB.Documents;
public class Account
{
diff --git a/Server/DB/Documents/Character.cs b/Server/DB/Documents/Character.cs
index d77b010..ee9be2c 100644
--- a/Server/DB/Documents/Character.cs
+++ b/Server/DB/Documents/Character.cs
@@ -1,10 +1,10 @@
-namespace Server.DB.Documents;
+namespace Server.DB.Documents;
public class Character
{
public byte ServerId { get; set; }
public Guid AccountId { get; set; }
- public Account Account { get; set; } = null!;
+ public Account Account { get; set; }
public Guid Id { get; set; }
public ushort MapId { get; set; }
public string Name { get; set; }
diff --git a/Server/DB/Documents/Gender.cs b/Server/DB/Documents/Gender.cs
index 8ce6b98..441de51 100644
--- a/Server/DB/Documents/Gender.cs
+++ b/Server/DB/Documents/Gender.cs
@@ -1,4 +1,4 @@
-namespace Server.DB.Documents;
+namespace Server.DB.Documents;
public enum Gender : byte
{
diff --git a/Server/DB/Documents/PvPLevel.cs b/Server/DB/Documents/PvPLevel.cs
index 5a6d00c..d1bb1ec 100644
--- a/Server/DB/Documents/PvPLevel.cs
+++ b/Server/DB/Documents/PvPLevel.cs
@@ -1,4 +1,4 @@
-namespace Server.DB.Documents;
+namespace Server.DB.Documents;
public enum PvPLevel : byte
{
diff --git a/Server/DB/Migrations/20230814114414_Initial.cs b/Server/DB/Migrations/20230814114414_Initial.cs
index 0a8961f..553279c 100644
--- a/Server/DB/Migrations/20230814114414_Initial.cs
+++ b/Server/DB/Migrations/20230814114414_Initial.cs
@@ -1,38 +1,26 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
#nullable disable
-namespace Server.DB.Migrations
+namespace Server.DB.Migrations;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+///
+public partial class Initial : Migration
{
///
- public partial class Initial : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Accounts",
- columns: table => new
- {
- Id = table.Column(type: "uuid", nullable: false),
- Username = table.Column(type: "varchar(20)", nullable: false),
- Password = table.Column(type: "bytea", nullable: false),
- Email = table.Column(type: "text", nullable: false),
- PermissionLevel = table.Column(type: "smallint", nullable: false),
- Salt = table.Column(type: "bytea", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Accounts", x => x.Id);
- });
- }
+ protected override void Up(MigrationBuilder migrationBuilder) => migrationBuilder.CreateTable(
+ name: "Accounts",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ Username = table.Column(type: "varchar(20)", nullable: false),
+ Password = table.Column(type: "bytea", nullable: false),
+ Email = table.Column(type: "text", nullable: false),
+ PermissionLevel = table.Column(type: "smallint", nullable: false),
+ Salt = table.Column(type: "bytea", nullable: false)
+ },
+ constraints: table => table.PrimaryKey("PK_Accounts", x => x.Id));
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Accounts");
- }
- }
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable(
+ name: "Accounts");
}
diff --git a/Server/DB/Migrations/20230817230423_CharacterDataDraft.cs b/Server/DB/Migrations/20230817230423_CharacterDataDraft.cs
index 41ed2f8..294ccb4 100644
--- a/Server/DB/Migrations/20230817230423_CharacterDataDraft.cs
+++ b/Server/DB/Migrations/20230817230423_CharacterDataDraft.cs
@@ -1,126 +1,123 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
#nullable disable
-namespace Server.DB.Migrations
+namespace Server.DB.Migrations;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+///
+public partial class CharacterDataDraft : Migration
{
///
- public partial class CharacterDataDraft : Migration
+ protected override void Up(MigrationBuilder migrationBuilder)
{
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn(
- name: "Username",
- table: "Accounts",
- type: "varchar(20)",
- nullable: true,
- oldClrType: typeof(string),
- oldType: "varchar(20)");
+ migrationBuilder.AlterColumn(
+ name: "Username",
+ table: "Accounts",
+ type: "varchar(20)",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "varchar(20)");
- migrationBuilder.AlterColumn(
- name: "Salt",
- table: "Accounts",
- type: "bytea",
- nullable: true,
- oldClrType: typeof(byte[]),
- oldType: "bytea");
+ migrationBuilder.AlterColumn(
+ name: "Salt",
+ table: "Accounts",
+ type: "bytea",
+ nullable: true,
+ oldClrType: typeof(byte[]),
+ oldType: "bytea");
- migrationBuilder.AlterColumn(
- name: "Password",
- table: "Accounts",
- type: "bytea",
- nullable: true,
- oldClrType: typeof(byte[]),
- oldType: "bytea");
+ migrationBuilder.AlterColumn(
+ name: "Password",
+ table: "Accounts",
+ type: "bytea",
+ nullable: true,
+ oldClrType: typeof(byte[]),
+ oldType: "bytea");
- migrationBuilder.AlterColumn(
- name: "Email",
- table: "Accounts",
- type: "text",
- nullable: true,
- oldClrType: typeof(string),
- oldType: "text");
+ migrationBuilder.AlterColumn(
+ name: "Email",
+ table: "Accounts",
+ type: "text",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "text");
- migrationBuilder.CreateTable(
- name: "Characters",
- columns: table => new
- {
- Id = table.Column(type: "uuid", nullable: false),
- ServerId = table.Column(type: "smallint", nullable: false),
- AccountId = table.Column(type: "uuid", nullable: false),
- MapId = table.Column(type: "integer", nullable: false),
- Name = table.Column(type: "varchar(20)", nullable: true),
- LastXCoordinate = table.Column(type: "smallint", nullable: false),
- LastYCoordinate = table.Column(type: "smallint", nullable: false),
- PvPLevel = table.Column(type: "smallint", nullable: false),
- Gender = table.Column(type: "smallint", nullable: false),
- Experience = table.Column(type: "bigint", nullable: false),
- Level = table.Column(type: "smallint", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Characters", x => x.Id);
- table.ForeignKey(
- name: "FK_Characters_Accounts_AccountId",
- column: x => x.AccountId,
- principalTable: "Accounts",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
+ migrationBuilder.CreateTable(
+ name: "Characters",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ ServerId = table.Column(type: "smallint", nullable: false),
+ AccountId = table.Column(type: "uuid", nullable: false),
+ MapId = table.Column(type: "integer", nullable: false),
+ Name = table.Column(type: "varchar(20)", nullable: true),
+ LastXCoordinate = table.Column(type: "smallint", nullable: false),
+ LastYCoordinate = table.Column(type: "smallint", nullable: false),
+ PvPLevel = table.Column(type: "smallint", nullable: false),
+ Gender = table.Column(type: "smallint", nullable: false),
+ Experience = table.Column(type: "bigint", nullable: false),
+ Level = table.Column(type: "smallint", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Characters", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Characters_Accounts_AccountId",
+ column: x => x.AccountId,
+ principalTable: "Accounts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
- migrationBuilder.CreateIndex(
- name: "IX_Characters_AccountId",
- table: "Characters",
- column: "AccountId");
- }
+ migrationBuilder.CreateIndex(
+ name: "IX_Characters_AccountId",
+ table: "Characters",
+ column: "AccountId");
+ }
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Characters");
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Characters");
- migrationBuilder.AlterColumn(
- name: "Username",
- table: "Accounts",
- type: "varchar(20)",
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "varchar(20)",
- oldNullable: true);
+ migrationBuilder.AlterColumn(
+ name: "Username",
+ table: "Accounts",
+ type: "varchar(20)",
+ nullable: false,
+ defaultValue: "",
+ oldClrType: typeof(string),
+ oldType: "varchar(20)",
+ oldNullable: true);
- migrationBuilder.AlterColumn(
- name: "Salt",
- table: "Accounts",
- type: "bytea",
- nullable: false,
- defaultValue: new byte[0],
- oldClrType: typeof(byte[]),
- oldType: "bytea",
- oldNullable: true);
+ migrationBuilder.AlterColumn(
+ name: "Salt",
+ table: "Accounts",
+ type: "bytea",
+ nullable: false,
+ defaultValue: Array.Empty(),
+ oldClrType: typeof(byte[]),
+ oldType: "bytea",
+ oldNullable: true);
- migrationBuilder.AlterColumn(
- name: "Password",
- table: "Accounts",
- type: "bytea",
- nullable: false,
- defaultValue: new byte[0],
- oldClrType: typeof(byte[]),
- oldType: "bytea",
- oldNullable: true);
+ migrationBuilder.AlterColumn(
+ name: "Password",
+ table: "Accounts",
+ type: "bytea",
+ nullable: false,
+ defaultValue: Array.Empty(),
+ oldClrType: typeof(byte[]),
+ oldType: "bytea",
+ oldNullable: true);
- migrationBuilder.AlterColumn(
- name: "Email",
- table: "Accounts",
- type: "text",
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "text",
- oldNullable: true);
- }
+ migrationBuilder.AlterColumn(
+ name: "Email",
+ table: "Accounts",
+ type: "text",
+ nullable: false,
+ defaultValue: "",
+ oldClrType: typeof(string),
+ oldType: "text",
+ oldNullable: true);
}
}
diff --git a/Server/DB/WonderkingContext.cs b/Server/DB/WonderkingContext.cs
index dfd3c5e..0b33c01 100644
--- a/Server/DB/WonderkingContext.cs
+++ b/Server/DB/WonderkingContext.cs
@@ -1,4 +1,4 @@
-namespace Server.DB;
+namespace Server.DB;
using Documents;
using Microsoft.EntityFrameworkCore;
diff --git a/Server/PacketHandlers/ChannelSelectionHandler.cs b/Server/PacketHandlers/ChannelSelectionHandler.cs
index 99a69cd..a8091b0 100644
--- a/Server/PacketHandlers/ChannelSelectionHandler.cs
+++ b/Server/PacketHandlers/ChannelSelectionHandler.cs
@@ -1,4 +1,4 @@
-namespace Server.PacketHandlers;
+namespace Server.PacketHandlers;
using DB;
using Microsoft.Extensions.Configuration;
diff --git a/Server/PacketHandlers/IPacketHandler.cs b/Server/PacketHandlers/IPacketHandler.cs
index 238b2aa..a9f1c86 100644
--- a/Server/PacketHandlers/IPacketHandler.cs
+++ b/Server/PacketHandlers/IPacketHandler.cs
@@ -1,4 +1,4 @@
-namespace Server.PacketHandlers;
+namespace Server.PacketHandlers;
using JetBrains.Annotations;
using NetCoreServer;
diff --git a/Server/PacketHandlers/LoginHandler.cs b/Server/PacketHandlers/LoginHandler.cs
index e139994..2d435e4 100644
--- a/Server/PacketHandlers/LoginHandler.cs
+++ b/Server/PacketHandlers/LoginHandler.cs
@@ -1,4 +1,4 @@
-namespace Server.PacketHandlers;
+namespace Server.PacketHandlers;
using System.Security.Cryptography;
using System.Text;
@@ -33,10 +33,12 @@ public class LoginHandler : IPacketHandler
// https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Chea1t_Sheet.html#argon2id
// "Use Argon2id with a minimum configuration of 19 MiB of memory, an iteration count of 2, and 1 degree of parallelism."
- var argon2Id = new Argon2id(Encoding.ASCII.GetBytes(packet.Password));
- argon2Id.MemorySize = 1024 * 19;
- argon2Id.Iterations = 2;
- argon2Id.DegreeOfParallelism = 1;
+ var argon2Id = new Argon2id(Encoding.ASCII.GetBytes(packet.Password))
+ {
+ MemorySize = 1024 * 19,
+ Iterations = 2,
+ DegreeOfParallelism = 1
+ };
if (account == null)
{
if (this.configuration.GetSection("Testing").GetValue("CreateAccountOnLogin"))
@@ -44,13 +46,13 @@ public class LoginHandler : IPacketHandler
argon2Id.Salt = RandomNumberGenerator.GetBytes(16);
var finalAccount =
await this.wonderkingContext.Accounts.AddAsync(new Account(packet.Username, Array.Empty(), "",
- 0, argon2Id.Salt));
- await this.wonderkingContext.SaveChangesAsync();
+ 0, argon2Id.Salt)).ConfigureAwait(true);
+ await this.wonderkingContext.SaveChangesAsync().ConfigureAwait(true);
argon2Id.AssociatedData = finalAccount.Entity.Id.ToByteArray();
- finalAccount.Entity.Password = await argon2Id.GetBytesAsync(16);
+ finalAccount.Entity.Password = await argon2Id.GetBytesAsync(16).ConfigureAwait(true);
this.wonderkingContext.Accounts.Update(finalAccount.Entity);
loginResponseReason = LoginResponseReason.Ok;
- await this.wonderkingContext.SaveChangesAsync();
+ await this.wonderkingContext.SaveChangesAsync().ConfigureAwait(true);
}
else
{
@@ -62,7 +64,7 @@ public class LoginHandler : IPacketHandler
{
argon2Id.Salt = account.Salt;
argon2Id.AssociatedData = account.Id.ToByteArray();
- var tempPasswordBytes = await argon2Id.GetBytesAsync(16);
+ var tempPasswordBytes = await argon2Id.GetBytesAsync(16).ConfigureAwait(true);
loginResponseReason = tempPasswordBytes.SequenceEqual(account.Password)
? LoginResponseReason.Ok
: LoginResponseReason.WrongPassword;
diff --git a/Server/Packets/IPacket.cs b/Server/Packets/IPacket.cs
index 2cf79bd..e5d5317 100644
--- a/Server/Packets/IPacket.cs
+++ b/Server/Packets/IPacket.cs
@@ -1,4 +1,4 @@
-namespace Server.Packets;
+namespace Server.Packets;
using JetBrains.Annotations;
diff --git a/Server/Packets/Incoming/ChannelSelectionPacket.cs b/Server/Packets/Incoming/ChannelSelectionPacket.cs
index 4163895..ea17fb4 100644
--- a/Server/Packets/Incoming/ChannelSelectionPacket.cs
+++ b/Server/Packets/Incoming/ChannelSelectionPacket.cs
@@ -1,4 +1,4 @@
-namespace Server.Packets.Incoming;
+namespace Server.Packets.Incoming;
[PacketId(OperationCode.ChannelSelection)]
public class ChannelSelectionPacket : IPacket
diff --git a/Server/Packets/Incoming/LoginInfoPacket.cs b/Server/Packets/Incoming/LoginInfoPacket.cs
index 3181457..4351884 100644
--- a/Server/Packets/Incoming/LoginInfoPacket.cs
+++ b/Server/Packets/Incoming/LoginInfoPacket.cs
@@ -1,4 +1,4 @@
-namespace Server.Packets.Incoming;
+namespace Server.Packets.Incoming;
using System.Text;
diff --git a/Server/Packets/OperationCode.cs b/Server/Packets/OperationCode.cs
index 96a3310..578c544 100644
--- a/Server/Packets/OperationCode.cs
+++ b/Server/Packets/OperationCode.cs
@@ -1,4 +1,4 @@
-namespace Server.Packets;
+namespace Server.Packets;
public enum OperationCode : ushort
{
diff --git a/Server/Packets/Outgoing/LoginResponsePacket.cs b/Server/Packets/Outgoing/LoginResponsePacket.cs
index eb2b471..63299fe 100644
--- a/Server/Packets/Outgoing/LoginResponsePacket.cs
+++ b/Server/Packets/Outgoing/LoginResponsePacket.cs
@@ -1,4 +1,4 @@
-namespace Server.Packets.Outgoing;
+namespace Server.Packets.Outgoing;
[PacketId(OperationCode.LoginResponse)]
public class LoginResponsePacket : IPacket
diff --git a/Server/Packets/Outgoing/LoginResponseReason.cs b/Server/Packets/Outgoing/LoginResponseReason.cs
index 574513a..f9dcf51 100644
--- a/Server/Packets/Outgoing/LoginResponseReason.cs
+++ b/Server/Packets/Outgoing/LoginResponseReason.cs
@@ -1,4 +1,4 @@
-namespace Server.Packets.Outgoing;
+namespace Server.Packets.Outgoing;
public enum LoginResponseReason : byte
{
diff --git a/Server/Packets/Outgoing/ServerChannelData.cs b/Server/Packets/Outgoing/ServerChannelData.cs
index 1d40818..a6eee00 100644
--- a/Server/Packets/Outgoing/ServerChannelData.cs
+++ b/Server/Packets/Outgoing/ServerChannelData.cs
@@ -1,4 +1,4 @@
-namespace Server.Packets.Outgoing;
+namespace Server.Packets.Outgoing;
public struct ServerChannelData
{
diff --git a/Server/Packets/PacketIdAttribute.cs b/Server/Packets/PacketIdAttribute.cs
index 1ca4bd1..6638733 100644
--- a/Server/Packets/PacketIdAttribute.cs
+++ b/Server/Packets/PacketIdAttribute.cs
@@ -1,4 +1,4 @@
-namespace Server.Packets;
+namespace Server.Packets;
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class PacketIdAttribute : Attribute
diff --git a/Server/Packets/RawPacket.cs b/Server/Packets/RawPacket.cs
index 879d80e..6f96690 100644
--- a/Server/Packets/RawPacket.cs
+++ b/Server/Packets/RawPacket.cs
@@ -1,4 +1,4 @@
-namespace Server.Packets;
+namespace Server.Packets;
using MassTransit;
diff --git a/Server/Program.cs b/Server/Program.cs
index 23ef13a..76327dd 100644
--- a/Server/Program.cs
+++ b/Server/Program.cs
@@ -1,4 +1,4 @@
-#pragma warning disable AV1500
+#pragma warning disable AV1500
using System.Net;
using System.Reflection;
using MassTransit;
@@ -38,8 +38,8 @@ using var host = builder.Build();
await using (var scope = host.Services.CreateAsyncScope())
{
var db = scope.ServiceProvider.GetRequiredService();
- await db.Database.MigrateAsync();
+ await db.Database.MigrateAsync().ConfigureAwait(true);
}
-await host.RunAsync();
+await host.RunAsync().ConfigureAwait(true);
#pragma warning restore AV1500
diff --git a/Server/Services/PacketDistributorService.cs b/Server/Services/PacketDistributorService.cs
index 40b17bf..4000f40 100644
--- a/Server/Services/PacketDistributorService.cs
+++ b/Server/Services/PacketDistributorService.cs
@@ -1,4 +1,4 @@
-namespace Server.Services;
+namespace Server.Services;
using System.Collections.Concurrent;
using System.Collections.Immutable;
@@ -12,8 +12,8 @@ using Microsoft.VisualBasic.CompilerServices;
using Newtonsoft.Json;
using PacketHandlers;
using Packets;
-using static DotNext.Metaprogramming.CodeGenerator;
using static DotNext.Linq.Expressions.ExpressionBuilder;
+using static DotNext.Metaprogramming.CodeGenerator;
public class PacketDistributorService : IHostedService
{
@@ -79,11 +79,8 @@ public class PacketDistributorService : IHostedService
.ToDictionary(type => type.GetCustomAttribute().Code);
if (packetsWithId is not { Count: 0 })
{
- packetsWithId.AsParallel().ForAll(packet =>
- {
- this.logger.LogTrace("Packet with ID: {PacketID} has been added as {PacketName}", packet.Key,
- packet.Value.FullName);
- });
+ packetsWithId.AsParallel().ForAll(packet => this.logger.LogTrace("Packet with ID: {PacketID} has been added as {PacketName}", packet.Key,
+ packet.Value.FullName));
return packetsWithId;
}
@@ -99,16 +96,13 @@ public class PacketDistributorService : IHostedService
i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IPacketHandler<>))).ToDictionary(type =>
type.GetInterfaces().First(t =>
t is { IsGenericType: true } && t.GetGenericTypeDefinition() == typeof(IPacketHandler<>))
- .GetGenericArguments().First().GetCustomAttribute()!.Code);
+ .GetGenericArguments().First().GetCustomAttribute().Code);
if (packetHandlersWithId is not { Count: 0 })
{
- packetHandlersWithId.AsParallel().ForAll(packetHandler =>
- {
- this.logger.LogTrace("PacketHandler with ID: {PacketID} has been added as {PacketName}",
+ packetHandlersWithId.AsParallel().ForAll(packetHandler => this.logger.LogTrace("PacketHandler with ID: {PacketID} has been added as {PacketName}",
packetHandler.Key,
- packetHandler.Value.FullName);
- });
+ packetHandler.Value.FullName));
return packetHandlersWithId;
}
diff --git a/Server/Services/WonderkingAuthServer.cs b/Server/Services/WonderkingAuthServer.cs
index 510caf2..6cbb8e7 100644
--- a/Server/Services/WonderkingAuthServer.cs
+++ b/Server/Services/WonderkingAuthServer.cs
@@ -1,4 +1,4 @@
-namespace Server.Services;
+namespace Server.Services;
using System.Net;
using System.Net.Sockets;
diff --git a/build/Build.cs b/build/Build.cs
index ba46dc2..d78a3f3 100644
--- a/build/Build.cs
+++ b/build/Build.cs
@@ -1,22 +1,10 @@
-using System;
-using System.Linq;
using Nuke.Common;
-using Nuke.Common.CI;
-using Nuke.Common.CI.GitHubActions;
-using Nuke.Common.Execution;
using Nuke.Common.Git;
using Nuke.Common.IO;
-using Nuke.Common.ProjectModel;
-using Nuke.Common.Tooling;
-using Nuke.Common.Tools.CodeMetrics;
using Nuke.Common.Tools.Docker;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.SonarScanner;
-using Nuke.Common.Utilities.Collections;
using Serilog;
-using static Nuke.Common.EnvironmentInfo;
-using static Nuke.Common.IO.FileSystemTasks;
-using static Nuke.Common.IO.PathConstruction;
class Build : NukeBuild
{
@@ -42,16 +30,10 @@ class Build : NukeBuild
Target Clean => _ => _
.Before(Restore)
- .Executes(() =>
- {
- DotNetTasks.DotNetClean();
- });
+ .Executes(() => DotNetTasks.DotNetClean());
Target Restore => _ => _
- .Executes(() =>
- {
- DotNetTasks.DotNetRestore();
- });
+ .Executes(() => DotNetTasks.DotNetRestore());
Target Compile => _ => _
.DependsOn(Clean)
diff --git a/build/Configuration.cs b/build/Configuration.cs
index 29edf2b..5519911 100644
--- a/build/Configuration.cs
+++ b/build/Configuration.cs
@@ -1,6 +1,4 @@
-using System;
using System.ComponentModel;
-using System.Linq;
using Nuke.Common.Tooling;
[TypeConverter(typeof(TypeConverter))]
@@ -9,8 +7,5 @@ public class Configuration : Enumeration
public static Configuration Debug { get; } = new() { Value = nameof(Debug) };
public static Configuration Release { get; } = new() { Value = nameof(Release) };
- public static implicit operator string(Configuration configuration)
- {
- return configuration.Value;
- }
+ public static implicit operator string(Configuration configuration) => configuration.Value;
}