示例#1
0
 public void Init()
 {
     _cSharpChecker = new CSharpChecker();
     _javaChecker   = new JavaChecker
     {
         JavaPath         = Helpers.GetJavaExePath(@"bin\java.exe"),
         JavaCompilerPath = Helpers.GetJavaExePath(@"bin\javac.exe"),
         ClassName        = "Program"
     };
     _phpChecker = new PhpChecker
     {
         PhpPath = @"C:\xampp\php\php.exe",
     };
 }
示例#2
0
        private void btnCompile_Click(object sender, EventArgs e)
        {
            bool input = (sender as Button).Name.Contains("Input");

            dgvCompileErrors.Rows.Clear();
            List <CheckingResult> compileResult;
            var cSharpChecker = new CSharpChecker();

            if (input)
            {
                compileResult = cSharpChecker.Compile(tbInput.Text);
            }
            else
            {
                compileResult = cSharpChecker.CompileAndRun(tbOutput.Text);
            }

            foreach (var result in compileResult)
            {
                if (result.IsError)
                {
                    dgvCompileErrors.Rows.Add(result.FirstErrorLine.ToString(), result.FirstErrorColumn.ToString(),
                                              result.Description, input ? "input" : "output");
                }
            }

            if (!input)
            {
                if (compileResult.Count == 1 && compileResult.First().Output != null)
                {
                    tbConsoleOutput.ResetText();
                    tbConsoleOutput.Text = compileResult.First().Output;
                    if (cbScrollToEnd.Checked && tbConsoleOutput.Text.Length > 0)
                    {
                        tbConsoleOutput.Select(tbConsoleOutput.Text.Length - 1, 0);
                        tbConsoleOutput.ScrollToCaret();
                    }
                }
            }
        }
示例#3
0
 public void Init()
 {
     _cSharpChecker = new CSharpChecker();
 }