Wait to create a new file until the app is ready to write it.

This commit is contained in:
NintenHero 2024-03-22 17:44:16 -05:00 committed by GitHub
parent 3c129b2505
commit 0c7afb94af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -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++;