diff --git a/Forms/FormMain.cs b/Forms/FormMain.cs index d89e1cb..565faa9 100644 --- a/Forms/FormMain.cs +++ b/Forms/FormMain.cs @@ -779,16 +779,19 @@ internal async Task HttpUploadLogAsync(string file, Dictionary p if (reportJson?.Error?.Contains("EI Failure") ?? false) { AddToText($">:> Due to an Elite Insights error while processing the log file, it will not be automatically reuploaded. Is the log file corrupted?"); + LogReuploader.RemovedLogAndSave(file); return; } if (reportJson?.Error?.Contains("An identical file was uploaded recently") ?? false) { AddToText($">:> To prevent same log regeneration, the upload try will not be automatically reuploaded."); + LogReuploader.RemovedLogAndSave(file); return; } if (reportJson?.Error?.Contains("Encounter is too short") ?? false) { AddToText($">:> Encounter is too short to generate a valid log, the upload try will not be automatically reuploaded."); + LogReuploader.RemovedLogAndSave(file); return; } } @@ -914,11 +917,7 @@ internal async Task HttpUploadLogAsync(string file, Dictionary p // report success AddToText($">:> {Path.GetFileName(file)} successfully uploaded."); // remove from failed logs if present - var removed = LogReuploader.FailedLogs.Remove(file); - if (removed) - { - LogReuploader.SaveFailedLogs(); - } + LogReuploader.RemovedLogAndSave(file); } catch (Exception e) { diff --git a/Tools/LogReuploader.cs b/Tools/LogReuploader.cs index aa9d257..2d5e3fb 100644 --- a/Tools/LogReuploader.cs +++ b/Tools/LogReuploader.cs @@ -57,6 +57,16 @@ internal static void SaveFailedLogs() } } + internal static bool RemovedLogAndSave(string file) + { + var removed = FailedLogs.Remove(file); + if (removed) + { + SaveFailedLogs(); + } + return removed; + } + internal static async Task ProcessLogs(SemaphoreSlim semaphore, Func, bool, Task> process) { foreach (var fileName in FailedLogs.ToArray())