From 0c7afb94afb3413fdf3cd444fe8e0a7f00725b06 Mon Sep 17 00:00:00 2001 From: NintenHero <37460517+MichaelHinrichs@users.noreply.github.com> Date: Fri, 22 Mar 2024 17:44:16 -0500 Subject: [PATCH] Wait to create a new file until the app is ready to write it. --- Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Program.cs b/Program.cs index 4becb00..26b9d82 100644 --- a/Program.cs +++ b/Program.cs @@ -11,11 +11,11 @@ namespace Warrecs_2_Extractor int i = 0; while (br.BaseStream.Position < br.BaseStream.Length) { - using FileStream FS = File.Create(Path.GetDirectoryName(args[0]) + "//" + Path.GetExtension(args[0]) + "//" + i); - BinaryWriter bw = new(FS); var variable = br.ReadBytes(4); System.Array.Reverse(variable); int size = System.BitConverter.ToInt32(variable, 0); + using FileStream FS = File.Create(Path.GetDirectoryName(args[0]) + "//" + Path.GetExtension(args[0]) + "//" + i); + BinaryWriter bw = new(FS); bw.Write(br.ReadBytes(size)); bw.Close(); i++;