Beispiel #1
0
        static void Main(params string[] args)
        {
            if (args.Length != 1 || !File.Exists(args[0]))
            {
                return;
            }
            ByterProject project = new ByterProject();

            project.LoadFiles(args[0]);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            OutputForm outf  = new OutputForm();
            DebugForm  debug = new DebugForm(project, project.MainMethod, outf);

            debug.IsMain = true;
            Application.Run(debug);
        }
Beispiel #2
0
 private void newProjectToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         string newProjectName  = "";
         bool   CreateNewFolder = true;
         if (InputBox.ShowDialog("Введите название проекта", "Название проекта", "Создать новую папку", ref newProjectName, ref CreateNewFolder) == DialogResult.OK &&
             folderBrowserDialog1.ShowDialog() == DialogResult.OK)
         {
             if (!System.Text.RegularExpressions.Regex.IsMatch(newProjectName, @"\w+"))
             {
                 MessageBox.Show("Incorrect project name!");
                 return;
             }
             string s = folderBrowserDialog1.SelectedPath;
             s += @"\";
             if (CreateNewFolder)
             {
                 s += newProjectName + @"\";
             }
             if (OpenedProject != null)
             {
                 this.closeProjectToolStripMenuItem_Click(sender, e);
             }
             OpenedProject = ByterProject.CreateProject(newProjectName + ".bytpr", s);
             projectExplorerBox.Items.Clear();
             codeTabControl.TabPages.Clear();
             foreach (var k in OpenedProject.FileNames)
             {
                 projectExplorerBox.Items.Add("Module " + k.Key);
             }
             this.AddTab(OpenedProject.MainMethod);
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }
Beispiel #3
0
 private void openProjectToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (openFileDialog1.ShowDialog(this) == DialogResult.OK && Path.GetExtension(openFileDialog1.FileName) == ".bytpr")
         {
             Directory.SetCurrentDirectory(Path.GetDirectoryName(openFileDialog1.FileName));
             ByterProject newProject = new ByterProject();
             newProject.LoadFiles(openFileDialog1.FileName);
             OpenedProject = newProject;
             projectExplorerBox.Items.Clear();
             codeTabControl.TabPages.Clear();
             foreach (var k in OpenedProject.FileNames)
             {
                 projectExplorerBox.Items.Add("Module " + k.Key);
             }
         }
     }
     catch (Exception x)
     {
         MessageBox.Show(x.Message);
     }
 }
Beispiel #4
0
 public DebugForm(ByterProject project, string methodName, OutputForm output)
 {
     if (project == null || methodName == null || output == null)
     {
         throw new ArgumentNullException("Cannot create debug form for empty procedure.");
     }
     InitializeComponent();
     Project   = project;
     CodeTable = new char[16, 16];
     Array.Copy(Project.Sources[methodName], CodeTable, 256);
     Output                    = output;
     CurrentPosition           = new Point(0, 0);
     IsMain                    = false;
     CurrentDirection          = Direction.Right;
     Child                     = Parent = null;
     dataGridView1.RowCount    = 16;
     dataGridView1.ColumnCount = 16;
     RefreshTable();
     for (int i = 0; i < 16; i++)
     {
         dataGridView1.Columns[i].Width = dataGridView1.Rows[i].Height;
     }
     Text += " — " + methodName;
 }