diff --git a/CLI/XlsxCommand.cs b/CLI/XlsxCommand.cs index 1259ab9b6..da35153cb 100644 --- a/CLI/XlsxCommand.cs +++ b/CLI/XlsxCommand.cs @@ -103,6 +103,7 @@ private async Task ProcessSingleFileExport() DemoPaths = _demoPaths, FocusSteamId = _focusSteamId, Source = _source, + ForceAnalyze = _forceAnalyze, OnProcessingDemo = (demoPath, demoNumber, totalDemoCount) => Console.WriteLine($@"Retrieving demo {demoNumber}/{totalDemoCount} {demoPath}"), OnDemoNotFound = demoPath => Console.WriteLine($@"The demo doesn't exists: {demoPath}"), OnInvalidDemo = demoPath => Console.WriteLine($@"Invalid demo {demoPath}"), @@ -122,6 +123,7 @@ private async Task ProcessMultipleFilesExport() { try { + Console.WriteLine($@"Retrieving demo {++currentDemoNumber}/{_demoPaths.Count} {demoPath}"); string outputFolderPath = BuildOutputFolderPathFromDemoPath(demoPath); string demoName = Path.GetFileName(demoPath); string fileName = outputFolderPath + Path.DirectorySeparatorChar + demoName + ".xlsx"; @@ -131,7 +133,6 @@ private async Task ProcessMultipleFilesExport() FileName = fileName, Source = _source, ForceAnalyze = _forceAnalyze, - OnProcessingDemo = () => Console.WriteLine($@"Retrieving demo {++currentDemoNumber}/{_demoPaths.Count} {demoPath}"), OnAnalyzeStart = () => Console.WriteLine($@"Analyzing demo {demoPath}"), }; await _excelService.GenerateXls(configuration); diff --git a/Services/Concrete/Excel/MultipleExport.cs b/Services/Concrete/Excel/MultipleExport.cs index c76c0f646..373bfeab5 100644 --- a/Services/Concrete/Excel/MultipleExport.cs +++ b/Services/Concrete/Excel/MultipleExport.cs @@ -65,7 +65,7 @@ public override async Task Generate() continue; } - if (!_configuration.ForceAnalyze && !_cacheService.HasDemoInCache(demo.Id)) + if (_configuration.ForceAnalyze || !_cacheService.HasDemoInCache(demo.Id)) { try { diff --git a/Services/Concrete/Excel/SingleExport.cs b/Services/Concrete/Excel/SingleExport.cs index 07107ebb7..a12dd53e5 100644 --- a/Services/Concrete/Excel/SingleExport.cs +++ b/Services/Concrete/Excel/SingleExport.cs @@ -50,24 +50,17 @@ public SingleExport(SingleExportConfiguration configuration) public override async Task Generate() { CancellationToken cancellationToken = _configuration.CancellationToken.Token; - _configuration.OnProcessingDemo?.Invoke(); Demo demo = DemoAnalyzer.ParseDemoHeader(_configuration.DemoPath); if (demo == null) { throw new InvalidDemoException(); } - if (!_configuration.ForceAnalyze && _cacheService.HasDemoInCache(demo.Id)) - { - demo = await _cacheService.GetDemoDataFromCache(demo.Id); - demo.WeaponFired = await _cacheService.GetDemoWeaponFiredAsync(demo); - demo.PlayerBlinded = await _cacheService.GetDemoPlayerBlindedAsync(demo); - cancellationToken.ThrowIfCancellationRequested(); - } - else + if (_configuration.ForceAnalyze || !_cacheService.HasDemoInCache(demo.Id)) { try { + _configuration.OnAnalyzeStart?.Invoke(); DemoAnalyzer analyzer = DemoAnalyzer.Factory(demo); if (_configuration.Source != null) { @@ -88,6 +81,13 @@ public override async Task Generate() throw new AnalyzeException(ex); } } + else + { + demo = await _cacheService.GetDemoDataFromCache(demo.Id); + demo.WeaponFired = await _cacheService.GetDemoWeaponFiredAsync(demo); + demo.PlayerBlinded = await _cacheService.GetDemoPlayerBlindedAsync(demo); + cancellationToken.ThrowIfCancellationRequested(); + } _generalSheet = new GeneralSheet(Workbook, demo); _generalSheet.Generate();