Exemplo n.º 1
0
        protected override void Seed(UserDataContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            UserProfileEntity profile = new UserProfileEntity()
            {
                Username        = "******",
                Organization    = "BIT",
                UserGroup       = UserGroup.Administrators,
                ProfileFileName = ApplicationDirectory.GetAppSubDirectory("Users") + "\\Lancern",
            };

            using (SHA512 hash = SHA512.Create())
            {
                profile.PasswordHash = hash.ComputeHash(Encoding.Unicode.GetBytes("Lancern"));
            }

            context.UserProfiles.AddOrUpdate(profile);
        }
Exemplo 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");
            }
        }
Exemplo 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);
            }
        }
Exemplo 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");
                }
            }
        }
Exemplo 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");
                }
            }
        }
 static FileSystemSettingProvider()
 {
     SettingsDirectory = ApplicationDirectory.GetAppSubDirectory(SettingsDirectoryName);
 }