示例#1
0
 void _script_artist_reset(string name, string code, int level)
 {
     if (string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(code) || level < 1 || level > 9)
     {
         this.logger.Log_Error("user and code can not be null.level must be 1~9");
         return;
     }
     if (config.getArtist(name) == null)
     {
         this.logger.Log_Error("user not exist,use artist_new().");
     }
     else
     {
         ServerConfig.Artist a = config.getArtist(name);
         //a.name = name;
         //a.code = code;
         byte[] sb = System.Text.Encoding.UTF8.GetBytes(code);
         byte[] wt = sha1.ComputeHash(sb);
         a.code  = Convert.ToBase64String(sb, 0, sb.Length);
         a.level = level;
         //config.users.Add(a);
         config.Save();
         this.logger.Log("user reseted.");
     }
 }
示例#2
0
 void _script_admin_set(string name)
 {
     if (string.IsNullOrWhiteSpace(name))
     {
         this.logger.Log_Error("user can not be null.");
         return;
     }
     if (config.getArtist(name) == null)
     {
         this.logger.Log_Error("user not exist,use artist_new().");
     }
     else
     {
         ServerConfig.Artist a = config.getArtist(name);
         a.level           = 99;
         config.superadmin = a.name;
         config.Save();
         this.logger.Log("user " + name + " became superadmin");
     }
 }