fixed argument parser

This commit is contained in:
2026-09-14 19:09:32 +02:00
parent 2618ec4728
commit f726597401
3 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -14,17 +14,17 @@ try
string? searchQuery = null; string? searchQuery = null;
new LaunchArgumentParser( new LaunchArgumentParser(
new LaunchArgument(["-i", "--input"], new LaunchArgument(["i", "input"],
"Set input file path", "Set input file path",
s => inputPath = s, s => inputPath = s,
"gamestate or zip file"), "gamestate or zip file"),
new LaunchArgument(["-o", "--output"], new LaunchArgument(["o", "output"],
"Set output file path", "Set output file path",
s => outputPath = s, s => outputPath = s,
"json file [default=stdout]"), "json file [default=stdout]"),
new LaunchArgument(["-s", "--search"], new LaunchArgument(["s", "search"],
"Search in input file", "Search in input file",
s => s =>
{ {
@@ -76,6 +76,7 @@ public class SaveParsingOperation
Dictionary<string, object> parsedData; Dictionary<string, object> parsedData;
await using (var gamestateStream = PathHelper.CreateTempFile()) await using (var gamestateStream = PathHelper.CreateTempFile())
{ {
// TODO: ckeck if it is zip archive or plain text like in Search.cs
using (var zipArchive = ZipFile.Open(_meta.GetSaveFilePath().Str, ZipArchiveMode.Read)) using (var zipArchive = ZipFile.Open(_meta.GetSaveFilePath().Str, ZipArchiveMode.Read))
{ {
var zipEntry = zipArchive.Entries.FirstOrDefault(e => e.Name == "gamestate"); var zipEntry = zipArchive.Entries.FirstOrDefault(e => e.Name == "gamestate");
+1 -1
View File
@@ -40,7 +40,7 @@ public static class Program
#endif #endif
new LaunchArgumentParser( new LaunchArgumentParser(
new LaunchArgument(["-d", "--debug"], new LaunchArgument(["d", "debug"],
"enables debug log output to console", "enables debug log output to console",
() => IsDebug = true) () => IsDebug = true)
).AllowNoArguments().ParseAndHandle(args); ).AllowNoArguments().ParseAndHandle(args);