Implemented statistics. Refactored storage abstractions. Added config options for docker and local storage. Added server service and server updating.

This commit is contained in:
2026-03-02 15:51:05 +00:00
parent 52dbd13fb5
commit 2d1b48b0d4
27 changed files with 493 additions and 147 deletions

View File

@@ -14,6 +14,7 @@ builder.Logging.AddConsoleFormatter<AppConsoleFormatter, ConsoleFormatterOptions
builder.Services.AddSingleton<ServerConfigurationService>();
builder.Services.AddSingleton<ServerFactory>();
builder.Services.AddSingleton<ServerService>();
builder.Services.AddDockerServices();
builder.Services.AddLocalServices();
@@ -31,23 +32,26 @@ Task.Run(async () =>
try
{
var factory = app.Services.GetRequiredService<ServerFactory>();
var server = await factory.CreateAsync("a0e3ddb4-2c72-4f4c-bc49-35650a4bc5c0");
var serverService = app.Services.GetRequiredService<ServerService>();
await server.InitializeAsync();
await serverService.SyncAsync("a0e3ddb4-2c72-4f4c-bc49-35650a4bc5c0");
await serverService.SyncAsync("a0e3ddb4-2c72-4f4c-bc49-35650a4bc5c0");
var server = await serverService.GetAsync("a0e3ddb4-2c72-4f4c-bc49-35650a4bc5c0");
if(server == null)
return;
Console.WriteLine($"Server: {server.State}");
Console.ReadLine();
if (server.State == ServerState.Offline)
await server.StartAsync();
else
await server.StopAsync();
Console.ReadLine();
await server.DisposeAsync();
await serverService.DeleteAsync("a0e3ddb4-2c72-4f4c-bc49-35650a4bc5c0");
}
catch (Exception e)
{