private int NumberOfOutputFiles()
        {
            DirectoryInfo directoryInfo = new DirectoryInfo(SystemFolder.GetTestOutDir());

            return(directoryInfo.GetFiles().Length);
        }
        private void excuteUsingJavaWithJudging()
        {
            Invoke((MethodInvoker) delegate
            {
                lbInfo.Items.Insert(0, "Compiling the code...");
            });
            string error = Java.Compile(SystemFile.GetJavaFilePath());

            if (!string.IsNullOrEmpty(error))
            {
                Invoke((MethodInvoker) delegate
                {
                    lbInfo.Items.Insert(0, Messages.GetErrorType(error));
                    rtbReport.Text = error;
                });
            }
            else
            {
                Invoke((MethodInvoker) delegate
                {
                    lbInfo.Items.Insert(0, "Compiled Successfully !.");
                });
                string[]      inputFilePaths     = SystemFile.GetInputFilePaths(SystemFolder.GetTestInDir());
                string[]      outputFilePaths    = SystemFile.GetOutputFilePaths(SystemFolder.GetTestInDir());
                DirectoryInfo correctOutputDir   = new DirectoryInfo(SystemFolder.GetTestOutDir());
                FileInfo[]    correctOutputFiles = correctOutputDir.GetFiles();
                int           i = 1;
                foreach (string inputFilePath in inputFilePaths)
                {
                    string fileInputContent = SystemFile.GetFileContentText(inputFilePath);
                    Invoke((MethodInvoker) delegate
                    {
                        lbInfo.Items.Insert(0, "Running test " + i + "...");
                    });
                    Result result = Java.Run(fileInputContent);
                    if (result.error.Length > 0)
                    {
                        Invoke((MethodInvoker) delegate
                        {
                            lbInfo.Items.Insert(0, Messages.GetErrorType(result.error.ToString()) + " at test " + i);
                            rtbReport.Text = result.error.ToString();
                        });
                        ErrorTests.Add(inputFilePath);
                        ErrorCount++;
                        i++;
                        continue;
                    }
                    File.WriteAllText(outputFilePaths[i - 1], result.output.ToString().TrimEnd('\n').TrimEnd('\r'));
                    if (CompareFile(outputFilePaths[i - 1], correctOutputFiles[i - 1].FullName))
                    {
                        PassedCount++;
                        PassedTests.Add(new Test(inputFilePath, correctOutputFiles[i - 1].FullName, outputFilePaths[i - 1]));
                    }
                    else
                    {
                        FailedCount++;
                        FailedTests.Add(new Test(inputFilePath, correctOutputFiles[i - 1].FullName, outputFilePaths[i - 1]));
                    }
                    i++;
                }
                TotalTestCount = inputFilePaths.Length;
                TestedCount    = PassedCount + FailedCount + ErrorCount;
                NotTestedCount = TotalTestCount - TestedCount;
            }
        }