コード例 #1
0
        public void LoadContest(string dir, string databaseFile = "contest.ojdb")
        {
            string problemDir = FS.Combine(dir, "Problems");

            if (!FS.DirectoryExist(problemDir))
            {
                throw new JudgeDirectoryNotFoundException(problemDir);
            }
            string userDir = FS.Combine(dir, "Users");

            if (!FS.DirectoryExist(userDir))
            {
                throw new JudgeDirectoryNotFoundException(userDir);
            }
            LoadProblemsDirectory(problemDir);
            LoadUsersDirectory(userDir);
            string offlineJudgeDBFile = FS.Combine(dir, databaseFile);

            if (!FS.FileExist(offlineJudgeDBFile))
            {
                judgeModel.Save(offlineJudgeDBFile);
            }
            else
            {
                judgeModel.Load(offlineJudgeDBFile);
            }
            CurrentContestDir = dir;
            IsOpen            = true;
        }