예제 #1
0
 public static void Main(string[] args)
 {
     judger = new Judger();
     judger.LoadContest(@"C:\Users\Nguyen Van\Source\Repos\OJCore\TestModule\Test01");
     judger.OnGradeStatusChanged += Judger_OnGradeStatusChanged;;
     while (true)
     {
         Console.Write("$ ");
         string cmd = Console.ReadLine();
         if (cmd == "exit")
         {
             judger.StopGrade();
             break;
         }
         else if (cmd == "stop")
         {
             Log.print(LogType.Warning, "Stopping...");
             judger.StopGrade();
         }
         else if (cmd == "grade")
         {
             if (!judger.IsGrading)
             {
                 InitFrm();
                 //judger.GradeSubmission("sumab", "rng58");
                 judger.GradeAll();
                 //judger.GradeUser("nnalovE");
             }
             else
             {
                 SendData("-----> ERROR JUDGE IS GRADING");
             }
         }
         else if (cmd == "export")
         {
             judger.ExportExcel();
         }
         else if (cmd == "save")
         {
             judger.SaveContest();
         }
         else if (cmd == "test")
         {
             //Console.WriteLine("Application directory = {0}", FS.JudgeAppDataDirectory);
             Console.WriteLine("Temp directory = {0}", FS.JudgeTempDirectory);
             Console.WriteLine("Workspace directory = {0}", FS.JudgeWorkspace);
         }
     }
     foreach (Form frm in listFrm)
     {
         frm.Invoke(new Action(() => { frm.Close(); }));
     }
 }
예제 #2
0
        public void Run(Problem problem, Submit submit)
        {
            Logger.Logger.InitLogger();
            Logger.Logger.Log.Info(String.Format("Solve ID:{0}", _factory.GetId()));

            Judger   judger   = new Judger(_factory, problem, submit);
            Protocol protocol = judger.Judge();

            Logger.Logger.Log.Info(String.Format("Sumbit Info\nLanguage:{0}\nSource code:{1}", protocol.Submit.SourceLanguage, protocol.Submit.SourceCode));
            Logger.Logger.Log.Info(String.Format("Build info\nBuild Result:{1}\nExit code:{0}", protocol.CompilationResult.ExitCode, protocol.CompilationResult.Result));
            Logger.Logger.Log.Info("Verdict info");

            foreach (var result in protocol.Results.Values)
            {
                string x = String.Format("Verdict:{0}\tMemory:{1}KB\tExecuting Time:{2}s\tExitCode:{3}", result.Verdict,
                                         result.UsedMemory.TotalKilobytes, result.UsedTime.TotalSeconds, result.ExitCode);

                Logger.Logger.Log.Info(x);
            }

            _protocolList.Add(protocol);
            _logUpdater.UpdateConfig();
        }