mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Add compression result reason to log
This commit is contained in:
@@ -149,6 +149,7 @@
|
||||
- Update Nuget packages
|
||||
- Remove deprecated protection setting
|
||||
- Update BurnOutSharp to 2.3.4
|
||||
- Add compression result reason to log
|
||||
|
||||
### 2.3 (2022-02-05)
|
||||
- Start overhauling Redump information pulling, again
|
||||
|
||||
@@ -407,11 +407,11 @@ namespace MPF.Library
|
||||
if (Options.CompressLogFiles)
|
||||
{
|
||||
resultProgress?.Report(Result.Success("Compressing log files..."));
|
||||
success = InfoTool.CompressLogFiles(this.OutputDirectory, this.OutputFilename, this.Parameters);
|
||||
if (success)
|
||||
resultProgress?.Report(Result.Success("Compression complete!"));
|
||||
(bool compressSuccess, string statement) = InfoTool.CompressLogFiles(this.OutputDirectory, this.OutputFilename, this.Parameters);
|
||||
if (compressSuccess)
|
||||
resultProgress?.Report(Result.Success(statement));
|
||||
else
|
||||
resultProgress?.Report(Result.Failure("Compression could not complete!"));
|
||||
resultProgress?.Report(Result.Failure(statement));
|
||||
}
|
||||
|
||||
resultProgress?.Report(Result.Success("Submission information process complete!"));
|
||||
|
||||
@@ -577,7 +577,7 @@ namespace MPF.Library
|
||||
/// <param name="outputFilename">Output filename to use as the base path</param>
|
||||
/// <param name="parameters">Parameters object to use to derive log file paths</param>
|
||||
/// <returns>True if the process succeeded, false otherwise</returns>
|
||||
public static bool CompressLogFiles(string outputDirectory, string outputFilename, BaseParameters parameters)
|
||||
public static (bool, string) CompressLogFiles(string outputDirectory, string outputFilename, BaseParameters parameters)
|
||||
{
|
||||
// Prepare the necessary paths
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
@@ -592,7 +592,7 @@ namespace MPF.Library
|
||||
files.AddRange(mpfFiles);
|
||||
|
||||
if (!files.Any())
|
||||
return true;
|
||||
return (true, "No files to compress!");
|
||||
|
||||
// If the file already exists, we want to delete the old one
|
||||
try
|
||||
@@ -602,7 +602,7 @@ namespace MPF.Library
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
return (false, "Could not delete old archive!");
|
||||
}
|
||||
|
||||
// Add the log files to the archive and delete the uncompressed file after
|
||||
@@ -626,11 +626,11 @@ namespace MPF.Library
|
||||
catch { }
|
||||
}
|
||||
|
||||
return true;
|
||||
return (true, "Compression complete!");
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
return (false, $"Compression could not complete: {ex}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user