Ejemplo n.º 1
0
        public void Debug(string code, string romFile)
        {
            debug.WriteHtml(string.Format("<h3>Debug Script at {0}</h3>", DateTime.Now));

            try
            {
                // Reset the compiler
                Reset();
                ROMFilePath = romFile;

                // Load ROM environment variable
                Definitions[LoadROMCode()] = 0;

                Line[] lines = Explode(code);
                Preprocess(lines);

                if (DebugMode == DebugLevel.Loud)
                {
                    debug.WriteHtml("<h4>Lexer:</h4>");
                    foreach (var line in lines)
                    {
                        debug.WriteHtmlLine("" + line.ToString() + "");
                    }
                }

                debug.WriteHtmlLine("<span style =\"color: green;\"><br>Success!</span>");
            }
            catch (Exception ex)
            {
                debug.WriteHtmlLine("<span style =\"color: red;\">" + ex.Message + "</span>");
                debug.WriteHtmlLine("Debug failed!");
            }
        }
Ejemplo n.º 2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            compiler = new Compiler(ref debug);
            if (!File.Exists("std.pks2"))
            {
                //MessageBox.Show("std.pks2 not found!\n\nThis isn't an error, it just means your scripts won't support the standard library of defined values.\n\nYou should probably go download it.", "Uh-oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                debug.WriteHtmlLine("<span style=\"color: red;\">std.pks2 not found!<br><br>This isn't an error, it just means your scripts won't support the standard library of defined values.<br><br>You should probably go download it.</span>");
            }

            using (IniReader std = new IniReader("Data\\standard.cdb"))
            {
                var names = std.ReadSection("names");

                foreach (string key in names.Keys)
                {
                    txtCode.Text += key + " ~ " + names[key] + "\n";
                }
            }

            debug.Show();
        }