private void button1_Click(object sender, EventArgs e) { Object o = listBox1.SelectedItem; if (o == null) { return; } OAFEntry ent = (OAFEntry)o; exportEntry = ent; saveFileDialog1.FileName = Path.GetFileName(ent.name); saveFileDialog1.ShowDialog(); }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { Object o = listBox1.SelectedItem; if (o == null) { return; } OAFEntry ent = (OAFEntry)o; checkBox1.Checked = ent.compressed; textBox2.Text = ent.uncompressedSize.ToString(); textBox3.Text = (ent.compressed)?ent.compressedSize.ToString():"N/A"; textBox4.Text = ent.dataOffset.ToString(); }
private void saveFileDialog1_FileOk(object sender, CancelEventArgs e) { OAFEntry ent = exportEntry; oaf.br.BaseStream.Seek(ent.dataOffset, SeekOrigin.Begin); int size = (ent.compressed) ? ent.compressedSize : ent.uncompressedSize; byte[] payload = oaf.br.ReadBytes(size); FileStream fs = new FileStream(saveFileDialog1.FileName, FileMode.Create); fs.Write(payload, 0, payload.Length); fs.Close(); Console.WriteLine("The contained file " + ent.name + " has been written to " + saveFileDialog1.FileName + "."); }