From ee5ac0108a8c6778d1e75bed50d7614701292963 Mon Sep 17 00:00:00 2001 From: ASpoonPlaysGames <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Fri, 26 May 2023 13:13:11 +0100 Subject: [PATCH] improve logging for texconv --- Advocate/DDS/Manager.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Advocate/DDS/Manager.cs b/Advocate/DDS/Manager.cs index c37607e..816ac04 100644 --- a/Advocate/DDS/Manager.cs +++ b/Advocate/DDS/Manager.cs @@ -190,21 +190,25 @@ public void GenerateMissingMips(string texconvPath) }; } + Logging.Logger.Debug("Starting texconv"); + // convert the dds into a dds with mipmaps using texconv - StringBuilder sb = new(); Process proc = new(); + proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; - proc.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data); - proc.ErrorDataReceived += (sender, args) => sb.AppendLine(args.Data); + proc.OutputDataReceived += (sender, args) => Logging.Logger.Debug(args.Data ?? ""); + proc.ErrorDataReceived += (sender, args) => Logging.Logger.Debug(args.Data ?? ""); proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.FileName = texconvPath; proc.StartInfo.Arguments = $"-f {format} -nologo -m 0 -bc d -o {temp3} -y {temp2}\\{temp}"; proc.Start(); + proc.BeginOutputReadLine(); + proc.BeginErrorReadLine(); proc.WaitForExit(); - Logging.Logger.Debug(sb.ToString()); + Logging.Logger.Debug("Loading file generated by texconv"); BinaryReader reader = new(new FileStream($"{temp3}\\{temp}", FileMode.Open)); LoadImage(reader);