From a514660aa21935ae44cb0f2e78e147bb454f31e4 Mon Sep 17 00:00:00 2001 From: AkiVer Date: Sun, 10 Jul 2022 10:51:38 +0200 Subject: [PATCH] feat(cli): add --force-analyze argument --- CLI/ExportCommand.cs | 4 ++++ CLI/JsonCommand.cs | 5 +++-- CLI/XlsxCommand.cs | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CLI/ExportCommand.cs b/CLI/ExportCommand.cs index fd01b787f..d89efa390 100644 --- a/CLI/ExportCommand.cs +++ b/CLI/ExportCommand.cs @@ -11,6 +11,7 @@ internal abstract class ExportCommand : BaseCommand protected Source _source; protected readonly List _demoPaths; protected string _outputFolderPath; + protected bool _forceAnalyze = false; protected List _availableSources = new List(); public ExportCommand(string commandName, string description) : base(commandName, description) @@ -80,6 +81,9 @@ protected void ParseArgs(string[] args, string[] allowedOptions) Environment.Exit(1); } + break; + case "--force-analyze": + _forceAnalyze = true; break; default: if (!allowedOptions.Contains(arg)) diff --git a/CLI/JsonCommand.cs b/CLI/JsonCommand.cs index 4ff324e7d..8b505e346 100644 --- a/CLI/JsonCommand.cs +++ b/CLI/JsonCommand.cs @@ -20,11 +20,12 @@ public override void PrintHelp() { Console.WriteLine(GetDescription()); Console.WriteLine(@""); - Console.WriteLine($@"Usage: {Program.ExeName} {COMMAND_NAME} demoPaths... [--output] [--source]"); + Console.WriteLine($@"Usage: {Program.ExeName} {COMMAND_NAME} demoPaths... [--output] [--source] [--force-analyze]"); Console.WriteLine(@""); Console.WriteLine(@"Demos path can be either .dem files location or a directory. It can be relative or absolute."); Console.WriteLine(@"The --output argument specify the directory where output files will be saved."); Console.WriteLine($@"The --source argument force the analysis logic of the demo analyzer. Available values: [{string.Join(",", _availableSources)}]"); + Console.WriteLine(@"The --force-analyze argument force demos analyzes (ignore cached data)."); Console.WriteLine(@""); Console.WriteLine(@"Examples:"); Console.WriteLine(@""); @@ -72,7 +73,7 @@ public override async Task Run(string[] args) demo.Source = _source; } - if (cacheService.HasDemoInCache(demo.Id)) + if (!_forceAnalyze && cacheService.HasDemoInCache(demo.Id)) { demo = await cacheService.GetDemoDataFromCache(demo.Id); demo.WeaponFired = await cacheService.GetDemoWeaponFiredAsync(demo); diff --git a/CLI/XlsxCommand.cs b/CLI/XlsxCommand.cs index 627d62483..8ff218491 100644 --- a/CLI/XlsxCommand.cs +++ b/CLI/XlsxCommand.cs @@ -23,12 +23,13 @@ public override void PrintHelp() { Console.WriteLine(GetDescription()); Console.WriteLine(@""); - Console.WriteLine($@"Usage: {Program.ExeName} {COMMAND_NAME} demoPaths... [--output] [--source] [--single]"); + Console.WriteLine($@"Usage: {Program.ExeName} {COMMAND_NAME} demoPaths... [--output] [--source] [--single] [--force-analyze]"); Console.WriteLine(@""); Console.WriteLine(@"Demos path can be either .dem files location or a directory. It can be relative or absolute."); Console.WriteLine(@"The --output argument specify the directory where output files will be saved."); Console.WriteLine($@"The --source argument force the analysis logic of the demo analyzer. Available values: [{string.Join(",", _availableSources)}]"); Console.WriteLine($@"The --single argument generates a single XLSX file instead of one per demo."); + Console.WriteLine(@"The --force-analyze argument force demos analyzes (ignore cached data)."); Console.WriteLine(@""); Console.WriteLine(@"Examples:"); Console.WriteLine(@""); @@ -87,7 +88,7 @@ public override async Task Run(string[] args) demo.Source = _source; } - if (cacheService.HasDemoInCache(demo.Id)) + if (!_forceAnalyze && cacheService.HasDemoInCache(demo.Id)) { demo = await cacheService.GetDemoDataFromCache(demo.Id); demo.WeaponFired = await cacheService.GetDemoWeaponFiredAsync(demo);