diff --git a/TextureExtraction tool/Data/Logger.cs b/TextureExtraction tool/Data/Logger.cs index 73b5ca44..efafd46e 100644 --- a/TextureExtraction tool/Data/Logger.cs +++ b/TextureExtraction tool/Data/Logger.cs @@ -11,6 +11,7 @@ public enum FileAction internal class ScanLogger : IDisposable { + private static readonly object LockFile = new object(); public string FullPath { get; private set; } @@ -40,7 +41,10 @@ private void GenerateLogFullPath(string directory) public void WriteLine(string value) { - LogFile.WriteLine(value); + lock (LockFile) + { + LogFile.WriteLine(value); + } } private void WriteHeader() @@ -69,32 +73,37 @@ public void WriteFoot(TextureExtractor.Result result) public void WriteEX(Exception ex,in string strMessage = "") { - LogFile.WriteLine("".PadLeft(64, '-')); - LogFile.WriteLine($"Error!!!... {strMessage} {ex?.Message}"); - LogFile.WriteLine($"{ex?.Source}:{ex?.StackTrace}"); - LogFile.WriteLine("".PadLeft(64, '-')); - Console.WriteLine("".PadLeft(64, '-')); - Console.WriteLine($"Error!!!... {strMessage} {ex?.Message}"); - Console.WriteLine("".PadLeft(64, '-')); + lock (LockFile) + { + LogFile.WriteLine("".PadLeft(64, '-')); + LogFile.WriteLine($"Error!!!... {strMessage} {ex?.Message}"); + LogFile.WriteLine($"{ex?.Source}:{ex?.StackTrace}"); + LogFile.WriteLine("".PadLeft(64, '-')); + Console.WriteLine($"Error!!!... {strMessage} {ex?.Message}"); + LogFile.Flush(); + } } public void Write(FileAction action,in string file,in string value) { - switch (action) + lock (LockFile) { - case FileAction.Unknown: - LogFile.WriteLine("Unknown:"); - break; - case FileAction.Unsupported: - LogFile.WriteLine("Unsupported:"); - break; - case FileAction.Extract: - LogFile.WriteLine("Extract:"); - break; + switch (action) + { + case FileAction.Unknown: + LogFile.WriteLine("Unknown:"); + break; + case FileAction.Unsupported: + LogFile.WriteLine("Unsupported:"); + break; + case FileAction.Extract: + LogFile.WriteLine("Extract:"); + break; + } + LogFile.Write($"\"~{file}\"\n"); + LogFile.WriteLine($" {value}"); + LogFile.Flush(); } - LogFile.Write($"\"~{file}\"\n"); - LogFile.WriteLine($" {value}"); - LogFile.Flush(); } #region Dispose diff --git a/TextureExtraction tool/Properties/AssemblyInfo.cs b/TextureExtraction tool/Properties/AssemblyInfo.cs index d0b802ed..480ea990 100644 --- a/TextureExtraction tool/Properties/AssemblyInfo.cs +++ b/TextureExtraction tool/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.6.4.0")] +[assembly: AssemblyVersion("0.6.4.1")] [assembly: AssemblyFileVersion("0.6.4.0")]