Esempio n. 1
0
        private static void InitializeRulesFromSettings()
        {
            FileSystemSettingProvider settings = new FileSystemSettingProvider();

            if (!settings.Contains(RulesSettingName))
            {
                // 不存在相应的规则设置。
                return;
            }
            else
            {
                ms_rules = settings.Get <ProblemUrlResolverRule[]>(RulesSettingName);
            }
        }
Esempio n. 2
0
        static UserManager()
        {
            ms_default = null;
            ms_lock    = new object();

            // 加载用户信息文件目录信息。
            FileSystemSettingProvider settings = new FileSystemSettingProvider();

            if (settings.Contains(ms_userDirectorySettingName))
            {
                ms_userDirectory = settings.Get <string>(ms_userDirectorySettingName);
            }
            else
            {
                // 加载默认目录名称。
                ms_userDirectory = ApplicationDirectory.GetAppSubDirectory("Users");
            }
        }
Esempio n. 3
0
        static ProblemArchieveManager()
        {
            ms_default = null;
            ms_sync    = new object();

            // 初始化本地主题目库根目录。
            FileSystemSettingProvider settings = new FileSystemSettingProvider();

            if (!settings.Contains(ArchieveDiretcorySettingName))
            {
                // 设置集中无根目录设置。设置为默认目录。
                ms_archieveDirectory = ApplicationDirectory.GetAppSubDirectory("ProblemArchieve");
            }
            else
            {
                ms_archieveDirectory = settings.Get <string>(ArchieveDiretcorySettingName);
            }
        }
Esempio n. 4
0
        static ContestManager()
        {
            ms_default  = null;
            ms_syncLock = new object();

            // 加载比赛目录信息。
            using (FileSystemSettingProvider settings = new FileSystemSettingProvider())
            {
                if (settings.Contains(ContestDirectorySettingName))
                {
                    ContestDirectory = settings.Get <string>(ContestDirectorySettingName);
                }
                else
                {
                    // 加载默认比赛目录。
                    ContestDirectory = ApplicationDirectory.GetAppSubDirectory("Contests");
                }
            }
        }
Esempio n. 5
0
        static SubmissionManager()
        {
            ms_default  = null;
            ms_syncLock = new object();

            // 加载用户提交代码文件目录信息。
            using (FileSystemSettingProvider settings = new FileSystemSettingProvider())
            {
                if (settings.Contains(SubmissionCodeFileDirectorySettingName))
                {
                    SubmissionCodeFilesDirectory = settings.Get <string>(SubmissionCodeFileDirectorySettingName);
                }
                else
                {
                    // 加载默认设置。
                    SubmissionCodeFilesDirectory = ApplicationDirectory.GetAppSubDirectory("Submissions");
                }
            }
        }
Esempio n. 6
0
        static VerdictAuthorization()
        {
            for (int i = 1; i < MonthDays.Length; ++i)
            {
                MonthDays[i] += MonthDays[i - 1];
            }

            // 从配置文件中加载客户端验证密钥。
            FileSystemSettingProvider setting = new FileSystemSettingProvider();

            if (setting.Contains(PasswordSettingName))
            {
                Password = setting.Get <string>(PasswordSettingName);
            }
            else
            {
                Password = string.Empty;
            }
        }