Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
// Use IntelliSense to find out which attributes exist for C# debugging.
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
{
"name": "Server:80",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-server",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/ReCap.Server/bin/Debug/net8.0/ReCap.Server.dll",
"cwd": "${workspaceFolder}/ReCap.Server/bin/Debug/net8.0",
"args": [],
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "externalTerminal",
"stopAtEntry": false
},
{
"name": "Server:80 (alternate DB path)",
"type": "coreclr",
"request": "launch",
/*
"preLaunchTask": "publish-server-linux",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/ReCap.Server/bin/Release/net8.0/linux-x64/publish/ReCap.Server.dll",
"cwd": "${workspaceFolder}/ReCap.Server/bin/Release/net8.0/linux-x64/publish",
*/
"preLaunchTask": "build-server",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/ReCap.Server/bin/Debug/net8.0/ReCap.Server.dll",
"cwd": "${workspaceFolder}/ReCap.Server/bin/Debug/net8.0",
"args": [
"--database-path=/home/splitwirez/.local/share/ResurrectionCapsule/server/db/",
],
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "externalTerminal",
"stopAtEntry": false
},
{
// https://stackoverflow.com/questions/3363892/what-non-standard-ports-are-safe-to-use#comment91403123_3363928
"name": "Server:9001",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-server",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/ReCap.Server/bin/Debug/net8.0/ReCap.Server.dll",
"cwd": "${workspaceFolder}/ReCap.Server/bin/Debug/net8.0",
"args": [
"--port=9001",
"--database-path=/home/splitwirez/.local/share/ResurrectionCapsule/server/db/",
],
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"files.watcherExclude": {
"**/bin/": true,
"**/obj/": true,
"lib/SharpRakNet/**/*.csproj": true,
},
"files.exclude": {
"**/bin/": true,
"**/obj/": true,
"lib/SharpRakNet/**/*.csproj": true,
},
"dotnet.preferCSharpExtension": true
}
42 changes: 42 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build-server",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/ReCap.Server/ReCap.Server.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
],
"problemMatcher": "$msCompile"
},
{
"label": "publish-server-linux",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/ReCap.Server/ReCap.Server.csproj",
"--self-contained", "true",
"-r", "linux-x64",
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/ReCap.Server/ReCap.Server.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace BlazeServer;
namespace ReCap.Server.Adapters.Blaze;

public class BlazeObjectType
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
namespace BlazeServer;

using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Sockets;

using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Tls;

using ReCap.Server.Adapters.Blaze.Ssl;

using ReCap.Server.Adapters.Blaze.Component.Association;
using ReCap.Server.Adapters.Blaze.Component.Authentication;
using ReCap.Server.Adapters.Blaze.Component;
using ReCap.Server.Adapters.Blaze.Component.GameManager;
using ReCap.Server.Adapters.Blaze.Component.Messaging;
using ReCap.Server.Adapters.Blaze.Component.Playgroups;
using ReCap.Server.Adapters.Blaze.Component.Redirector;
using ReCap.Server.Adapters.Blaze.Component.Rooms;
using ReCap.Server.Adapters.Blaze.Component.UserSessions;
using ReCap.Server.Adapters.Blaze.Component.Util;
using ReCap.Server.Config.Sqlite;

public class Server
using ReCap.Server.Config;

namespace ReCap.Server.Adapters.Blaze;

public class BlazeServer
{
private CancellationTokenSource CancellationTokenSource { get; set; }
private TcpListener Listener { get; }
Expand All @@ -38,7 +28,7 @@ public class Server
public int Port { get; }
public bool Running { get; private set; }

public Server(SqliteConfig newSqliteConfig, string name, IPAddress hostAddress, int port, bool isSecure, string hostname)
public BlazeServer(SqliteConfig newSqliteConfig, string name, IPAddress hostAddress, int port, bool isSecure, string hostname)
{
Name = name;
IsSecure = isSecure;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Sockets;

using Org.BouncyCastle.Tls;

namespace BlazeServer;

using ReCap.Server.Adapters.Blaze.Ssl;

namespace ReCap.Server.Adapters.Blaze;

public class Client
{
private byte[] ReceiveBuffer { get; }
Expand All @@ -17,7 +15,7 @@
private TlsServerProtocol? SslStream { get; }
private Stream CommStream { get; set; }

public Server Server { get; }
public BlazeServer Server { get; }
[MemberNotNullWhen(true, nameof(SslStream))]
public bool IsSecure => Server.IsSecure;
public IPEndPoint EndPoint { get; } = null!;
Expand All @@ -26,7 +24,7 @@
public ulong UserId { get; set; }
public string AuthToken { get; set; }

public Client(Server server, TcpClient tcpClient)
public Client(BlazeServer server, TcpClient tcpClient)

Check warning on line 27 in ReCap.Server/Adapters/Blaze/Client.cs

View workflow job for this annotation

GitHub Actions / build (osx-arm64)

Non-nullable property 'AuthToken' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
{
ReceiveBuffer = ArrayPool<byte>.Shared.Rent(0x10000);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
namespace ReCap.Server.Adapters.Blaze.Component.Association;
using ReCap.Server.Util;

using BlazeServer;
using ReCap.Server.Utils.Logger;
namespace ReCap.Server.Adapters.Blaze.Component;

public class AssociationListsComponent : IComponent
{
public ushort Id { get; } = 0x19;
public Server? Server { get; set; }
public BlazeServer? Server { get; set; }

public bool HandlePacket(Client client, Packet packet)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
using System.Buffers.Binary;
using System.Text;
using ReCap.Server.Config;
using ReCap.Server.Services;
using ReCap.Server.Util;

namespace ReCap.Server.Adapters.Blaze.Component.Authentication;

using BlazeServer;

using ReCap.Server.Adapters.Blaze.Component.UserSessions;
using ReCap.Server.Adapters.Blaze.Component.Util;
using ReCap.Server.Config.Sqlite;
using ReCap.Server.Service.Account;
using ReCap.Server.Utils.Logger;
namespace ReCap.Server.Adapters.Blaze.Component;

public class AuthenticationComponent : IComponent
{
Expand All @@ -22,7 +17,7 @@ public AuthenticationComponent(SqliteConfig newSqliteConfig) {
public static uint CurrentUnixTime => (uint)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;

public ushort Id { get; } = 1;
public Server? Server { get; set; }
public BlazeServer? Server { get; set; }

public bool HandlePacket(Client client, Packet packet)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
namespace ReCap.Server.Adapters.Blaze.Component.GameManager;
using ReCap.Server.Config;
using ReCap.Server.Services;
using ReCap.Server.Util;

using BlazeServer;

using ReCap.Server.Adapters.Blaze.Component.Util;
using ReCap.Server.Config.Sqlite;
using ReCap.Server.Service.Game;
using ReCap.Server.Utils.Logger;
namespace ReCap.Server.Adapters.Blaze.Component.GameManager;

public class GameManagerComponent : IComponent
{
public static uint CurrentUnixTime => (uint)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;

public ushort Id => 4;
public Server? Server { get; set; }
public BlazeServer? Server { get; set; }
public IGameHandler? GameHandler { get; set; }

private GameService gameService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
namespace ReCap.Server.Adapters.Blaze.Component.GameManager;
using ReCap.Server.Util;

using BlazeServer;
using ReCap.Server.Utils.Logger;
namespace ReCap.Server.Adapters.Blaze.Component.GameManager;

public class GameReportingComponent : IComponent
{
public ushort Id { get; } = 0x1C;
public Server? Server { get; set; }
public BlazeServer? Server { get; set; }

public bool HandlePacket(Client client, Packet packet)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace BlazeServer;
namespace ReCap.Server.Adapters.Blaze.Component;

public interface IComponent
{
ushort Id { get; }

Server? Server { get; set; }
BlazeServer? Server { get; set; }

bool HandlePacket(Client client, Packet packet);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
namespace ReCap.Server.Adapters.Blaze.Component.Messaging;
using ReCap.Server.Util;

using BlazeServer;
using ReCap.Server.Utils.Logger;
namespace ReCap.Server.Adapters.Blaze.Component;

public class MessagingComponent : IComponent
{
public ushort Id { get; } = 0xF;
public Server? Server { get; set; }
public BlazeServer? Server { get; set; }

public bool HandlePacket(Client client, Packet packet)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
namespace ReCap.Server.Adapters.Blaze.Component.Playgroups;
using ReCap.Server.Adapters.Blaze.Component.GameManager;
using ReCap.Server.Util;

using ReCap.Server.Adapters.Blaze.Component.GameManager;
using BlazeServer;
using ReCap.Server.Adapters.Blaze.Component.Util;
using ReCap.Server.Utils.Logger;
namespace ReCap.Server.Adapters.Blaze.Component;

public class PlaygroupsComponent : IComponent
{
public ushort Id => 6;
public Server? Server { get; set; }
public BlazeServer? Server { get; set; }

public bool HandlePacket(Client client, Packet packet)
{
Expand Down
Loading
Loading