private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 1) { ListViewItem item = listView1.SelectedItems[0]; DatabasePackedFile.Entry indexEntry = (DatabasePackedFile.Entry)indexEntries[Convert.ToInt32(item.SubItems[5].Text)]; txtLongName.Text = lookupList.lookup(indexEntry.Key.TypeId).longName; txtInstanceID.Text = indexEntry.Key.InstanceId.ToString("X16"); txtOffset.Text = indexEntry.Offset.ToString(); txtGroupId.Text = indexEntry.Key.GroupId.ToString("X8"); textBox25.Text = "key:" + indexEntry.Key.TypeId.ToString("X8") + ":" + txtGroupId.Text + ":" + txtInstanceID.Text; Stream input = File.OpenRead(this.currentFile.FullName); Database db = new Database(input, true); textBox4.Visible = false; panel1.Visible = false; listView2.Visible = false; this.lockImage = true; chkShowAlpha.Visible = false; chkShowBlue.Visible = false; chkShowGreen.Visible = false; chkShowRed.Visible = false; this.lockImage = false; switch (indexEntry.Key.TypeId) { case 0x034AEECB: // Cas Part textBox4.Visible = true; textBox4.Text = ""; Stream caspStream = db.GetResourceStream(indexEntry.Key); showCaspFile(caspStream); caspStream.Close(); break; case 0x01661233: // MODL listView2.Visible = true; listView2.Items.Clear(); Stream modlStream = db.GetResourceStream(indexEntry.Key); showModlFile(modlStream); modlStream.Close(); break; case 0x067CAA11: // Blend Geometry listView2.Visible = true; listView2.Items.Clear(); Stream bgeoStream = db.GetResourceStream(indexEntry.Key); showBlendGeomFile(bgeoStream); bgeoStream.Close(); break; case 0x0358B08A: // Face Part File listView2.Visible = true; listView2.Items.Clear(); Stream fpartStream = db.GetResourceStream(indexEntry.Key); showFacePartFile(fpartStream); fpartStream.Close(); break; case 0xb52f5055: // Facial Blend listView2.Visible = true; listView2.Items.Clear(); Stream fblendStream = db.GetResourceStream(indexEntry.Key); showFacialBlendFile(fblendStream); fblendStream.Close(); break; case 0x033A1435: // Texture Compositor listView2.Visible = true; listView2.Items.Clear(); Stream txtcStream = db.GetResourceStream(indexEntry.Key); showTextureCompositorFile(txtcStream); txtcStream.Close(); break; case 0x736884F1: // VPXY listView2.Visible = true; listView2.Items.Clear(); Stream vpxyStream = db.GetResourceStream(indexEntry.Key); showVpxyFile(vpxyStream); vpxyStream.Close(); break; case 0x0166038C: // Key name listView2.Visible = true; listView2.Items.Clear(); Stream keyNameFile = db.GetResourceStream(indexEntry.Key); showKeyNameFile(keyNameFile); keyNameFile.Close(); break; case 0x00b2d882: // DDS panel1.Visible = true; ddsFile.Load(db.GetResourceStream(indexEntry.Key)); this.lockImage = true; pictureBox1.Image = ddsFile.Image(); chkShowAlpha.Visible = true; chkShowBlue.Visible = true; chkShowGreen.Visible = true; chkShowRed.Visible = true; chkShowAlpha.Checked = false; chkShowBlue.Checked = true; chkShowGreen.Checked = true; chkShowRed.Checked = true; this.lockImage = false; break; // XML case 0x73e93eeb: case 0xd4d9fbe5: case 0x0333406c: textBox4.Visible = true; textBox4.Text = Encoding.ASCII.GetString(db.GetResource(indexEntry.Key)); break; case 0x015a1849: // GEOM listView2.Visible = true; listView2.Items.Clear(); Stream geominput = db.GetResourceStream(indexEntry.Key); showGeomFile(geominput); geominput.Close(); break; } input.Close(); } }
private void button7_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 1) { ListViewItem item = listView1.SelectedItems[0]; DatabasePackedFile.Entry indexEntry = (DatabasePackedFile.Entry)indexEntries[Convert.ToInt32(item.SubItems[5].Text)]; metaEntry mEntry = lookupList.lookup(indexEntry.Key.TypeId); if (mEntry.shortName == "") { mEntry.shortName = "unk"; } txtLongName.Text = mEntry.longName; txtInstanceID.Text = indexEntry.Key.InstanceId.ToString("X16"); txtOffset.Text = indexEntry.Offset.ToString(); Stream input = File.OpenRead(this.currentFile.FullName); Database db = new Database(input, true); Stream output = db.GetResourceStream(indexEntry.Key); FileStream saveFile = new FileStream(this.currentFile.DirectoryName + "\\" + txtLongName.Text + "_" + indexEntry.Key.TypeId.ToString("X8") + "_" + indexEntry.Key.GroupId.ToString("X8") + "_" + txtInstanceID.Text + "." + mEntry.shortName, FileMode.Create, FileAccess.Write); ReadWriteStream(output, saveFile); saveFile.Close(); output.Close(); input.Close(); } }