From b2ea6101b5d387ae3edacaf5c3a8775724762d2c Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Thu, 10 Dec 2020 18:02:52 +0100 Subject: [PATCH] IL2CPP: Use BinaryObjectWriter to save decrypted strings --- Il2CppInspector.Common/IL2CPP/Metadata.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Il2CppInspector.Common/IL2CPP/Metadata.cs b/Il2CppInspector.Common/IL2CPP/Metadata.cs index 2d86e51..17452b0 100644 --- a/Il2CppInspector.Common/IL2CPP/Metadata.cs +++ b/Il2CppInspector.Common/IL2CPP/Metadata.cs @@ -194,10 +194,11 @@ namespace Il2CppInspector } // Write changes back in case the user wants to save the metadata file - using (var sw = new StreamWriter(BaseStream, System.Text.Encoding.UTF8, bufferSize: -1, leaveOpen: true)) { - sw.BaseStream.Position = Header.stringOffset; + using (var sw = new BinaryObjectWriter(BaseStream, Endianness, leaveOpen: true)) { + sw.Version = Version; + sw.Position = Header.stringOffset; foreach (var str in Strings.OrderBy(s => s.Key)) - sw.Write(str.Value + "\0"); + sw.WriteNullTerminatedString(str.Value); sw.Flush(); }