mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-21 00:05:19 +00:00
Fix CFB stream name handling
This commit is contained in:
@@ -244,7 +244,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
var obj = new DirectoryEntry();
|
||||
|
||||
byte[] name = data.ReadBytes(64);
|
||||
obj.Name = Encoding.Unicode.GetString(name).DecodeStreamName();
|
||||
obj.Name = Encoding.Unicode.GetString(name).DecodeStreamName()?.TrimEnd('\0');
|
||||
obj.NameLength = data.ReadUInt16LittleEndian();
|
||||
obj.ObjectType = (ObjectType)data.ReadByteValue();
|
||||
obj.ColorFlag = (ColorFlag)data.ReadByteValue();
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace SabreTools.Serialization
|
||||
}
|
||||
|
||||
output[q] = 0;
|
||||
return Encoding.ASCII.GetString(output);
|
||||
return Encoding.UTF8.GetString(output);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -103,6 +103,8 @@ namespace SabreTools.Serialization.Printers
|
||||
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
builder.AppendLine(entry.Name?.TrimEnd('\0'), " Name");
|
||||
if (entry.Name != null)
|
||||
builder.AppendLine(Encoding.UTF8.GetBytes(entry.Name), " Name (bytes)");
|
||||
builder.AppendLine(entry.NameLength, " Name length");
|
||||
builder.AppendLine($" Object type: {entry.ObjectType} (0x{entry.ObjectType:X})");
|
||||
builder.AppendLine($" Color flag: {entry.ColorFlag} (0x{entry.ColorFlag:X})");
|
||||
|
||||
Reference in New Issue
Block a user