changed CLI settings

This commit is contained in:
Timerix 2025-03-23 23:38:00 +05:00
parent 5d88ad49c0
commit c0e3eccdc2
3 changed files with 12 additions and 25 deletions

View File

@ -13,23 +13,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DTLib.Web" Version="1.2.1" />
</ItemGroup>
<ItemGroup>
<Compile Remove="data\**" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="data\**" />
</ItemGroup>
<ItemGroup>
<Content Remove="data\**" />
</ItemGroup>
<ItemGroup>
<None Remove="data\**" />
<None Remove="Properties\launchSettings.json" />
<PackageReference Include="DTLib.Web" Version="1.2.2" />
</ItemGroup>
</Project>

View File

@ -28,7 +28,11 @@ public class Program
{
private static readonly IOPath _configPath = "./config.dtsod";
private static Config _config = new();
private static readonly ILogger _loggerRoot = new ConsoleLogger();
private static readonly ILogger _loggerRoot = new CompositeLogger(
new ConsoleLogger(),
new FileLogger("logs", "ParadoxSaveParser.WebAPI"));
private static readonly CancellationTokenSource _mainCancel = new();
private static ConcurrentDictionary<string, SaveFileMetadata> _saveMetadataStorage = new();
@ -44,9 +48,11 @@ public class Program
{
Console.InputEncoding = Encoding.UTF8;
Console.OutputEncoding = Encoding.UTF8;
Console.CursorVisible = false;
ContextLogger logger = new ContextLogger(nameof(Main), _loggerRoot);
Console.CancelKeyPress += (_, _) =>
Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
logger.LogInfo("Ctrl+C Pressed");
_mainCancel.Cancel();
};
@ -104,7 +110,8 @@ public class Program
throw new Exception("Guid collision!");
}
}
// ReSharper disable once NotAccessedPositionalProperty.Global
public record ErrorMessage(string errorMessage);
private static async Task<HttpStatusCode>ReturnResponse(HttpListenerContext ctx, HttpStatusCode statusCode, object response)
@ -187,7 +194,7 @@ public class Program
new ErrorMessage("Invalid save format: no 'gamestate' file found"));
string extractedGamestatePath = PathHelper.GetSaveFilePath(meta.id) + ".gamestate";
zipEntry.ExtractToFile(extractedGamestatePath);
zipEntry.ExtractToFile(extractedGamestatePath, true);
var gamestateStream = File.OpenRead(extractedGamestatePath);
meta.status = SaveFileProcessingStatus.Parsing;

View File

@ -1,6 +1,3 @@
DTLib.Web:
Add elapsed time to response status log message: `responded 200 (OK) in 0.03 s`
Main:
Add temporary files deletion