From ee3ddee5fddb8cca59b62b5f451da665c754039a Mon Sep 17 00:00:00 2001 From: NintenHero <37460517+MichaelHinrichs@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:08:18 -0500 Subject: [PATCH] Streamline name reading --- Program.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Program.cs b/Program.cs index 7e6cc19..6f137ba 100644 --- a/Program.cs +++ b/Program.cs @@ -43,18 +43,7 @@ static void Main(string[] args) br.BaseStream.Position = metaOffset; for (int i = 0; i < subfile.Length; i++) { - long nameOffset = br.BaseStream.Position; - char[] fileName = Array.Empty(); - char readChar = (char)1; - while (readChar > 0) - { - readChar = br.ReadChar(); - Array.Resize(ref fileName, fileName.Length + 1); - fileName[^1] = readChar; - } - Array.Resize(ref fileName, fileName.Length - 1); - subfile[i].Name = new(fileName); - br.BaseStream.Position = nameOffset + 0XF8; + subfile[i].Name = new string(br.ReadChars(0XF8)).TrimEnd('\0'); subfile[i].Offset = br.ReadUInt32(); subfile[i].Size = br.ReadUInt32(); }