예제 #1
0
        public void EventLoop()
        {
            while (events.Count > 0)
            {
                LoadTests   loader = new LoadTests();
                List <Test> tests  = new List <Test>();
                List <Test> tests1 = new List <Test>();

                tests  = loader.Get("B:\\tests\\adunare", "adunare");
                tests1 = loader.Get("B:\\tests\\ciurul", "ciurul");

                GCC gcc = new GCC(@"C:\MinGW\bin\g++.exe");
                CompilerFactory.RegisterCompiler("C++", gcc);
                CompilerFactory.RegisterCompiler("C++11", gcc);
                CompilerFactory.RegisterCompiler("C+11", gcc);

                CompilerFactory.RegisterCompiler("C++14", gcc);
                CompilerFactory.RegisterCompiler("C", gcc);



                tests.AddRange(tests1);
                Repository repository = new Repository();
                repository.Tests = tests;


                Judge          judge      = new Judge("B:\\evaluare", "C++", repository);
                SubmissionJson submission = events.Dequeue().Submission;

                submission.Code = submission.Code.Replace("@", System.Environment.NewLine);


                SaveSolution saveSolution = new SaveSolution(submission.Code, @"B:\solutions", submission.ProblemName + submission.SubmissionAccountId, "cpp");
                saveSolution.SaveFile();

                Dictionary <int, string> submissionsPaths = new Dictionary <int, string>();
                submissionsPaths[submission.Id] = saveSolution.GetCodePath();

                judge.SetSubmissionPath(submissionsPaths);

                judge.Evaluate(submission);
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            //EventQueue events = new EventQueue();
            //TcpServer.Queue = events;

            //TcpServer.Start();
            LoadTests   loader = new LoadTests();
            List <Test> tests  = new List <Test>();
            List <Test> tests1 = new List <Test>();

            tests  = loader.Get("B:\\tests\\adunare", "adunare");
            tests1 = loader.Get("B:\\tests\\ciurul", "ciurul");

            for (int i = 0; i < tests1.Count; ++i)
            {
                tests.Add(tests1[i]);
            }

            Repository repository = new Repository();

            repository.Tests = tests;

            Judge          judge      = new Judge("B:\\evaluare", "GCCCompiler", repository);
            SubmissionJson submission = new SubmissionJson
            {
                Code                = "#include <iostream> using namespace std; int main() { cout << 1 ; return 0; }",
                Language            = "C++",
                SubmissionAccountId = "1",
                SubmissionProblemId = 1
            };


            judge.Evaluate(submission);


            Console.Read();
        }