Ejemplo n.º 1
0
        private void openMI_Click(object sender, EventArgs e)
        {
            if (openFile.ShowDialog() == DialogResult.OK)
            {
                SaveAndClose();
                try {
                    memView.Close();
                    memView.Dispose();
                } catch { }
                MPU.CommitMemory();
                if (OneXFile.ExtractOneXFile(openFile.FileName, "currentfile"))
                {
                    saveFileName = openFile.FileName;
                    string dir = Application.UserAppDataPath + "\\currentfile";
                    codeFileName = dir + "\\code";
                    codeBox.OpenFile(codeFileName, Encoding.UTF8);
                    MPU.InitMemory(dir + "\\memory");
                    memView           = new MemoryViewer();
                    codeBox.IsChanged = false;
                    modifiedinfo.Text = Path.GetFileName(saveFileName) + " - *No Changes*";

                    codeBox.Visible = true;
                }
                else
                {
                    MessageBox.Show("The selected *.onex file is in invalid format!", "Invalid format!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    CloseFile();
                }
            }
        }
Ejemplo n.º 2
0
 private async void nextStepBtn_Click(object sender, EventArgs e)
 {
     if (MPU.PC < MainForm.startAddress)
     {
         MPU.PC = MainForm.startAddress;
     }
     await Task.Run(() => MPU.NextStep());
 }
Ejemplo n.º 3
0
        private void CloseFile()
        {
            codeBox.Clear();
            string dir = Application.UserAppDataPath + "\\currentfile";

            codeFileName      = dir + "\\code";
            codeBox.IsChanged = false;
            modifiedinfo.Text = "";
            try {
                memView.Close();
                memView.Dispose();
            } catch { }
            try { MPU.CommitMemory(); Directory.Delete(dir, true); } catch (IOException) { } catch (NullReferenceException) { }

            codeBox.Visible = false;
        }
Ejemplo n.º 4
0
        private void New()
        {
            SaveAndClose();
            codeBox.Clear();
            string dir = Application.UserAppDataPath + "\\currentfile";

            codeFileName      = dir + "\\code";
            modifiedinfo.Text = "Untitled - *No Changes*";
            try {
                memView.Close();
                memView.Dispose();
            } catch { }
            try { MPU.CommitMemory(); }  catch (NullReferenceException) { }
            try { Directory.Delete(dir, true); } catch (IOException) { }
            Directory.CreateDirectory(dir);
            MPU.InitMemory(dir + "\\memory");
            memView           = new MemoryViewer();
            codeBox.IsChanged = false;

            codeBox.Visible = true;
        }
Ejemplo n.º 5
0
        private void SaveFile(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                saveasMI.PerformClick(); return;
            }
            saveFileName = name;
            string dir = Application.UserAppDataPath + "\\currentfile";

            codeFileName = dir + "\\code";
            codeBox.SaveToFile(codeFileName, Encoding.UTF8);
            try {
                memView.Close();
                memView.Dispose();
            } catch { }
            MPU.CommitMemory();
            OneXFile.RepackOneXFile(name, "currentfile");
            MPU.InitMemory(dir + "\\memory");
            memView = new MemoryViewer();
            // commit changes (reset all dirty flags)
            codeBox.IsChanged = false;
            modifiedinfo.Text = Path.GetFileName(saveFileName) + " - *Changes Saved*";
        }
Ejemplo n.º 6
0
 private void stopBtn_Click(object sender, EventArgs e)
 {
     MPU.Stop();
 }
Ejemplo n.º 7
0
 private async void execButton_Click(object sender, EventArgs e) => await Task.Run(() => MPU.ExecuteAllSteps());
Ejemplo n.º 8
0
 private async void nextStepBtn_Click(object sender, EventArgs e) => await Task.Run(() => MPU.NextStep());
Ejemplo n.º 9
0
 private void resetBtn_Click(object sender, EventArgs e)
 {
     MPU.Stop();
     MPU.PC = MainForm.startAddress;
 }