Skip to content

Commit

Permalink
improve logging for texconv
Browse files Browse the repository at this point in the history
  • Loading branch information
ASpoonPlaysGames committed May 26, 2023
1 parent e0c9618 commit ee5ac01
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Advocate/DDS/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ee5ac01

Please sign in to comment.