private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { listBox1.Items.Clear(); AB.Extract(bldPath + "\\" + comboBox1.SelectedIndex.ToString("D4"), bldPath); for (int i = 0; i < Directory.GetFiles(bldPath + "\\" + "header").Length; i++) { string bldName = ""; System.IO.BinaryReader readID = new System.IO.BinaryReader(File.OpenRead(bldPath + "\\" + "header" + "\\" + i.ToString("D4"))); System.IO.BinaryReader read = new System.IO.BinaryReader(File.OpenRead(bldPath + "\\" + "model" + "\\" + i.ToString("D4"))); read.BaseStream.Position = 0x14; if (read.ReadUInt32() == 0x304C444D) { read.BaseStream.Position = 0x34; } else { read.BaseStream.Position = 0x38; } for (int nameLength = 0; nameLength < 16; nameLength++) { int currentByte = read.ReadByte(); byte[] mapBytes = new Byte[] { Convert.ToByte(currentByte) }; // Reads map name if (currentByte != 0) { bldName = bldName + Encoding.UTF8.GetString(mapBytes); } } listBox1.Items.Add(i.ToString("D2") + ": " + bldName + " (" + readID.ReadInt16() + ")"); read.Close(); readID.Close(); } listBox1.SelectedIndex = 0; }
private void button1_Click(object sender, EventArgs e) // Save { if (!checkBox1.Checked) { AB.Pack(Form1.workingFolder + @"data\a\2\2\exBld", Form1.workingFolder + @"data\a\2\2\exBld" + "\\" + comboBox1.SelectedIndex.ToString("D4")); } else { if (Form1.IsBW) { AB.Pack(Form1.workingFolder + @"data\a\2\3\inBld", Form1.workingFolder + @"data\a\2\3\inBld" + "\\" + comboBox1.SelectedIndex.ToString("D4")); } else { AB.Pack(Form1.workingFolder + @"data\a\2\2\inBld", Form1.workingFolder + @"data\a\2\2\inBld" + "\\" + comboBox1.SelectedIndex.ToString("D4")); } } }