Take any pkdwin or pkiwin file

Closes #1.
This commit is contained in:
MichaelHinrichs 2025-01-12 13:34:12 -06:00
parent f8fa0e938c
commit 4140f7d8e2

View File

@ -8,9 +8,9 @@ namespace PixelJunk_Extractor
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
using FileStream pkiwin = File.OpenRead(args[0] + "//shooter.pkiwin"); BinaryReader br = new(File.OpenRead(Path.GetDirectoryName(args[0]) + "//" + Path.GetFileNameWithoutExtension(args[0]) + ".pkiwin"));
BinaryReader br = new(pkiwin); string path = Path.GetDirectoryName(args[0]);
Directory.CreateDirectory(args[0] + "//shooter"); Directory.CreateDirectory(path + "//" + Path.GetFileNameWithoutExtension(args[0]));
br.BaseStream.Position = 8; br.BaseStream.Position = 8;
SUBFILE[] subfiles = new SUBFILE[br.ReadInt32()]; SUBFILE[] subfiles = new SUBFILE[br.ReadInt32()];
for (int i = 0; i < subfiles.Length; i++) for (int i = 0; i < subfiles.Length; i++)
@ -21,12 +21,12 @@ namespace PixelJunk_Extractor
br.ReadInt32();//unknown br.ReadInt32();//unknown
} }
int n = 0; int n = 0;
using FileStream pkdwin = File.OpenRead(args[0] + "//shooter.pkdwin"); using FileStream pkdwin = File.OpenRead(path + "//" + Path.GetFileNameWithoutExtension(args[0]) + ".pkdwin");
foreach (SUBFILE sub in subfiles) foreach (SUBFILE sub in subfiles)
{ {
br = new(pkdwin); br = new(pkdwin);
br.BaseStream.Position = sub.offset; br.BaseStream.Position = sub.offset;
using FileStream FS = File.Create(args[0] + "//shooter//" + n); using FileStream FS = File.Create(path + "//" + Path.GetFileNameWithoutExtension(args[0]) + "//" + n);
BinaryWriter bw = new(FS); BinaryWriter bw = new(FS);
MemoryStream ms = new(); MemoryStream ms = new();
@ -42,6 +42,7 @@ namespace PixelJunk_Extractor
br.Close(); br.Close();
} }
} }
struct SUBFILE struct SUBFILE
{ {
public int sizeUncompressed; public int sizeUncompressed;