public TextureArchive[] ReadTextures(BinaryReader pacStream) { int nfiles = pacStream.ReadInt32(); pacStream.ReadBytes(12); //The rest of the header. Not important... var textures = new TextureArchive[nfiles]; for (var i = 0; i < nfiles; i++) { var texture = new TextureArchive(); texture.alignedstring = new string(pacStream.ReadChars(16)); texture.extension = new string(pacStream.ReadChars(4)); texture.size = pacStream.ReadInt32(); texture.offset = pacStream.ReadInt32(); pacStream.ReadBytes(4); var pos = pacStream.BaseStream.Position; pacStream.BaseStream.Position = texture.offset; texture.stream = pacStream.ReadBytes(texture.size); pacStream.BaseStream.Position = pos; textures[i] = texture; } return(textures); }
public TextureArchive[] ReadTextures(BinaryReader pacStream) { int nfiles = pacStream.ReadInt32(); pacStream.ReadBytes(12); //The rest of the header. Not important... var textures = new TextureArchive[nfiles]; for (var i = 0; i < nfiles; i++) { var texture = new TextureArchive(); texture.alignedstring = new string(pacStream.ReadChars(16)); texture.extension = new string(pacStream.ReadChars(4)); texture.size = pacStream.ReadInt32(); texture.offset = pacStream.ReadInt32(); pacStream.ReadBytes(4); var pos = pacStream.BaseStream.Position; pacStream.BaseStream.Position = texture.offset; texture.stream = pacStream.ReadBytes(texture.size); pacStream.BaseStream.Position = pos; textures[i] = texture; } return textures; }
private void option1ToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem item in listView1.SelectedItems) { string name = Path.GetDirectoryName(file) + "\\" + item.SubItems[0].Text; if (item.Tag.GetType().Equals(typeof(TextureArchive))) { TextureArchive texfile = (TextureArchive)item.Tag; efile.ExtractFile(texfile.stream, name); } if (item.Tag.GetType().Equals(typeof(PacFile))) { PacFile pacfile = (PacFile)item.Tag; efile.ExtractFile(pacfile.stream, name); } if (item.Tag.GetType().Equals(typeof(PACHFile))) { PACHFile pachfile = (PACHFile)item.Tag; efile.ExtractFile(pachfile.stream, name); } if (item.Tag.GetType().Equals(typeof(PACH))) { PACH pachcontainer = (PACH)item.Tag; efile.ExtractFile(pachcontainer.PACHFiles[0].stream, name); } } }