コード例 #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();
                }
            }
        }
コード例 #2
0
ファイル: Executer.cs プロジェクト: lsalamon/Project-OneX
 private async void nextStepBtn_Click(object sender, EventArgs e)
 {
     if (MPU.PC < MainForm.startAddress)
     {
         MPU.PC = MainForm.startAddress;
     }
     await Task.Run(() => MPU.NextStep());
 }
コード例 #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;
        }
コード例 #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;
        }
コード例 #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*";
        }
コード例 #6
0
ファイル: OldMainForm.cs プロジェクト: lsalamon/Project-OneX
 private void stopBtn_Click(object sender, EventArgs e)
 {
     MPU.Stop();
 }
コード例 #7
0
ファイル: OldMainForm.cs プロジェクト: lsalamon/Project-OneX
 private async void execButton_Click(object sender, EventArgs e) => await Task.Run(() => MPU.ExecuteAllSteps());
コード例 #8
0
ファイル: OldMainForm.cs プロジェクト: lsalamon/Project-OneX
 private async void nextStepBtn_Click(object sender, EventArgs e) => await Task.Run(() => MPU.NextStep());
コード例 #9
0
ファイル: Executer.cs プロジェクト: lsalamon/Project-OneX
 private void resetBtn_Click(object sender, EventArgs e)
 {
     MPU.Stop();
     MPU.PC = MainForm.startAddress;
 }