예제 #1
0
파일: Form1.cs 프로젝트: Bannersean/osu-sgl
        private void compileBtn_Click(object sender, EventArgs e)
        {
            outputBox.Text = "";
            errorBox.Text = "";

            try
            {

                Compiler compiler = new Compiler();
                compiler.SetTimeRecording(true);
                outputBox.Text = compiler.Run(inputBox.Text);

            }
            catch (CompilerException ce)
            {
                /*
                if (ce.ErrorType.Equals("Antlr.Parser"))
                {
                    errorBox.Text = "Error (wrong syntax) on " + ce.Message;
                }
                else
                {
                    errorBox.Text = "Error (" + ce.ErrorType + ") on line " + ce.Line + ": " + ce.Message;
                }*/
            }
            catch (Exception ex)
            {
                outputBox.Text = "Es ist ein Fehler aufgetreten.";
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
        }
예제 #2
0
		private void compileSBButton_Click(object sender, EventArgs e) {
			storyboardBox.Document.Text = "";
			errorBox.Text = "";

			// Visual stuff
			compilerPBar.Style = ProgressBarStyle.Marquee;
			statusLabel.Text = "Compiling...";

			try {
				//Console.WriteLine("input Text: " + SGLBox.Document.Text);
				Compiler compiler = new Compiler();
				//compiler.SetTimeRecording(false);
				storyboardBox.Document.Text = compiler.Run(SGLBox.Document.Text);

				statusLabel.Text = "";
				tabControl.SelectedTab = tabSB;

			} catch (CompilerException ce) {
				statusLabel.Text = "Error occured";
				errorBox.Text = ce.GetExceptionAsString();

			} catch (Exception ue) {
				statusLabel.Text = "Unexpected error occured";
				errorBox.Text = "An unexpected error occured:\r\n" + ue.Message + "\r\n" + ue.StackTrace;

			} finally {
				// Visual stuff
				compilerPBar.Style = ProgressBarStyle.Continuous;
			}
		}