Warrecs-2-Extractor/Program.cs

27 lines
965 B
C#
Raw Permalink Normal View History

2024-03-24 16:34:01 +01:00
//Written for Warrecs 2. https://store.steampowered.com/app/1360500
using System.IO;
2024-03-06 23:40:07 +01:00
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++;
}
}
}
}