Skip to content

Commit c85fd3e

Browse files
Fix debug logging to write to temp file
1 parent 4796af5 commit c85fd3e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Maple2.File.IO/Nif/NifDocument.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@ private void ParseImplementation() {
157157
if (RelPath.Contains("trophy_crimsonbalrog")) {
158158
using var md5 = System.Security.Cryptography.MD5.Create();
159159
byte[] hash = md5.ComputeHash(fileData);
160-
Console.Error.WriteLine($"[NIF DEBUG] {RelPath}: dataLen={fileData.Length} md5={Convert.ToHexString(hash)} " +
160+
string dbg = $"[NIF DEBUG] {RelPath}: dataLen={fileData.Length} md5={Convert.ToHexString(hash)} " +
161161
$"headerLen={index - 4} endianByte=0x{fileData[index]:X2} isLittleEndian={isLittleEndian} " +
162-
$"swap={isLittleEndian != BitConverter.IsLittleEndian} BitConverter.IsLittleEndian={BitConverter.IsLittleEndian}");
163-
Console.Error.WriteLine($"[NIF DEBUG] bytes around endian flag [{index-2}..{index+3}]: {Convert.ToHexString(fileData, index - 2, 5)}");
162+
$"swap={isLittleEndian != BitConverter.IsLittleEndian} BitConverter.IsLittleEndian={BitConverter.IsLittleEndian}\n" +
163+
$"[NIF DEBUG] bytes around endian flag [{index-2}..{index+3}]: {Convert.ToHexString(fileData, index - 2, 5)}\n";
164+
System.IO.File.AppendAllText(Path.Combine(Path.GetTempPath(), "nif_debug.log"), dbg);
164165
}
165166

166167
MemoryStream stream = new MemoryStream(fileData);

0 commit comments

Comments
 (0)