Warrecs-2-Extractor/Program.cs

26 lines
899 B
C#
Raw Normal View History

2024-03-06 23:40:07 +01:00
using System.IO;
namespace Warrecs_2_Extractor
{
class Program
{
static void Main(string[] args)
{
BinaryReader br = new BinaryReader(File.OpenRead(args[0]));
Directory.CreateDirectory(Path.GetDirectoryName(args[0]) + "//" + Path.GetExtension(args[0]));
int i = 0;
while (br.BaseStream.Position < br.BaseStream.Length)
{
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);
2024-03-06 23:40:07 +01:00
bw.Write(br.ReadBytes(size));
bw.Close();
i++;
}
}
}
}