private void openBinaryToolStripMenuItem_Click(object sender, EventArgs e) { string cmpBinaryFilePath = string.Empty; string cmpS6xFilePath = string.Empty; string sError = string.Empty; bool bError = false; if (openFileDialogBin.ShowDialog() != DialogResult.OK) { return; } if (!File.Exists(openFileDialogBin.FileName)) { sError += openFileDialogBin.FileName + "\r\n"; sError += "Not existing Binary."; MessageBox.Show(sError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } cmpBinaryFilePath = openFileDialogBin.FileName; FileInfo fiFI = new FileInfo(cmpBinaryFilePath); cmpS6xFilePath = fiFI.Directory.FullName + "\\" + fiFI.Name.Substring(0, fiFI.Name.Length - fiFI.Extension.Length) + ".s6x"; fiFI = null; if (!File.Exists(cmpS6xFilePath)) { cmpS6xFilePath = string.Empty; } cmpSadBin = null; cmpSadS6x = null; System.Windows.Forms.Cursor processPreviousCursor = Cursor; Cursor = System.Windows.Forms.Cursors.WaitCursor; cmpSadBin = new SADBin(cmpBinaryFilePath, cmpS6xFilePath); cmpSadS6x = cmpSadBin.S6x; bError = (cmpSadBin == null); if (bError) { sError += cmpBinaryFilePath + "\r\n"; sError += "Unrecognized Binary."; Cursor = processPreviousCursor; MessageBox.Show(sError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Text = getTitle(); return; } bError = (!cmpSadBin.isLoaded || !cmpSadBin.isValid); if (bError) { sError += cmpBinaryFilePath + "\r\n"; sError += "Unrecognized Binary."; Cursor = processPreviousCursor; MessageBox.Show(sError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Text = getTitle(); return; } cmpSadBin.processBin(); bError = (!cmpSadBin.isDisassembled); if (bError) { sError += cmpBinaryFilePath + "\r\n"; sError += "Binary can not be disassembled."; Cursor = processPreviousCursor; MessageBox.Show(sError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Text = getTitle(); return; } string[] arrSBytes = cmpSadBin.Calibration.getBytesArray(cmpSadBin.Calibration.AddressBankInt, cmpSadBin.Calibration.Size); arrCmpBytes = new byte[arrSBytes.Length]; for (int iPos = 0; iPos < arrCmpBytes.Length; iPos++) { arrCmpBytes[iPos] = Convert.ToByte(arrSBytes[iPos], 16); } arrSBytes = null; setupChart(ref calibComparedChart, ref arrCmpBytes, ref cmpSadBin, ref cmpSadS6x); Cursor = processPreviousCursor; calibComparedChart.Visible = true; this.Text = getTitle(); }