public Form1(int offset, string fileName)
{
InitializeComponent();
this.MaximumSize = this.MinimumSize = this.Size;
SetupTool();
if (File.Exists(fileName))
{
if (Path.GetExtension(fileName).ToUpper().Equals(".GBA"))
{
byte[] rom = File.ReadAllBytes(fileName);
headersNeeded = new Dictionary<string, bool>();
headersNeeded.Add("abilities", false);
headersNeeded.Add("moves", false);
headersNeeded.Add("pokemon", false);
headersNeeded.Add("items", false);
List<string> toReturn = DecompileScript(location, File.ReadAllBytes(selectedROMPath)).ToList();
bool insertReturn = false;
int countLines = 0;
foreach (string s in headersNeeded.Keys)
{
if (headersNeeded[s])
{
toReturn.Insert(0, "#include " + s + ".bsh");
countLines++;
insertReturn = true;
}
}
if (insertReturn)
{
toReturn.Insert(countLines, "");
}
scripts[tabControl1.SelectedIndex].Lines = toReturn.ToArray();
headersNeeded.Clear();
}
else
{
MessageBox.Show("This file format is unsupported.");
}
this.KeyPreview = true;
this.KeyDown += new KeyEventHandler(Form_KeyDown);
}
}