private void OpenFile()
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
IsBMGLoaded = false;
IsBMCLoaded = false;
if (Yaz0.IsYaz0Compressed(openFileDialog1.FileName))
{
MessageBox.Show("Archive is compressed. Please decompress it.");
return;
}
RARC archive = new RARC(openFileDialog1.FileName);
int numRARCNodes = archive.Nodes.Count();
if (numRARCNodes < 0)
return;
foreach (RARC.FileEntry entry in archive.Nodes[0].Entries)
{
if (entry.Name.EndsWith(".bmg"))
{
TextBankBMG = entry;
TextBankClass = new BMG_New(new EndianBinaryReader(entry.Data, Endian.Big));
if (TextBankClass.IsWindWaker == false)
{
MessageBox.Show("The BMG file in this archive is not from The Wind Waker. BMG files from other games are not supported at this time.");
return;
}
ArcFilePath = openFileDialog1.FileName;
saveFileDialog1.InitialDirectory = ArcFilePath;
IsBMGLoaded = true;
MessageList = TextBankClass.GetMessageList();
saveToolStripMenuItem.Enabled = true;
AddToolStrip.Enabled = true;
deleteToolStripMenuItem.Enabled = true;
proofreadToolStripMenuItem.Enabled = true;
searchBoxBackPanel.Controls[0].Enabled = true;
SearchButton.Enabled = true;
textOpt.Enabled = true;
idOpt.Enabled = true;
LoadMainUI();
}
if (entry.Name.EndsWith(".bmc"))
{
TextColorBMC = entry;
IsBMCLoaded = true;
textColorsToolStripMenuItem.Enabled = true;
ColorClass = new BMCParser(new EndianBinaryReader(entry.Data, Endian.Big));
ColorList = ColorClass.GetColorList();
}
}
if (!IsBMGLoaded && IsBMCLoaded)
MessageBox.Show("Archive does not contain a text bank (.bmg).");
if (IsBMGLoaded && !IsBMCLoaded)
MessageBox.Show("Archive does not contain a text color file (.bmc).");
if (!IsBMGLoaded && !IsBMCLoaded)
MessageBox.Show("Archive does not contain a text bank (.bmg) or a text color file (.bmc).");
}
return;
}