public void LoadFile(string path) { using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read)) { var newCDL = new CodeDataLog(); newCDL.Load(fs); //have the core create a CodeDataLog to check mapping information against var testCDL = new CodeDataLog(); CodeDataLogger.NewCDL(testCDL); if (!newCDL.Check(testCDL)) { MessageBox.Show(this, "CDL file does not match emulator's current memory map!"); return; } //ok, it's all good: _cdl = newCDL; CodeDataLogger.SetCDL(null); if (tsbLoggingActive.Checked || Global.Config.CDLAutoStart) { CodeDataLogger.SetCDL(_cdl); } SetCurrentFilename(path); } UpdateDisplay(true); }
protected override void OnClosed(EventArgs e) { //deactivate logger if (CodeDataLogger != null) //just in case... { CodeDataLogger.SetCDL(null); } }
private void tsbLoggingActive_CheckedChanged(object sender, EventArgs e) { if (tsbLoggingActive.Checked && _cdl == null) { //implicitly create a new file NewFileLogic(); } if (_cdl != null && tsbLoggingActive.Checked) { CodeDataLogger.SetCDL(_cdl); } else { CodeDataLogger.SetCDL(null); } }
void NewFileLogic() { _cdl = new CodeDataLog(); CodeDataLogger.NewCDL(_cdl); if (tsbLoggingActive.Checked || Global.Config.CDLAutoStart) { CodeDataLogger.SetCDL(_cdl); } else { CodeDataLogger.SetCDL(null); } SetCurrentFilename(null); UpdateDisplay(true); }
private void DisassembleMenuItem_Click(object sender, EventArgs e) { if (_cdl == null) { MessageBox.Show(this, "Cannot disassemble with no CDL loaded!", "Alert"); return; } var sfd = new SaveFileDialog(); var result = sfd.ShowDialog(this); if (result == DialogResult.OK) { using (var fs = new FileStream(sfd.FileName, FileMode.Create, FileAccess.Write)) { CodeDataLogger.DisassembleCDL(fs, _cdl); } } }
void ShutdownCDL() { _cdl = null; CodeDataLogger.SetCDL(null); }