Ejemplo n.º 1
0
 public User(User u)
 {
     _username = u.UserName;
     _state = u.State;
     _nickname = u.NickName;
     _authLevel = u.AuthLevel;
 }
Ejemplo n.º 2
0
 public User(string username, string nickname, UserState state, UserAuthLevel auth)
 {
     _username = username;
     _state = state;
     _nickname = nickname;
     _authLevel = auth;
 }
Ejemplo n.º 3
0
        //add user function to add to users.ini
        public bool AddUser(string username, string nickname, UserAuthLevel auth)
        {
            bool result = false;

            Logger.LogInformation("runtime add user request for " + username + "(" + nickname + ") " + auth.ToString());
            UserState state = UserState.Allowed;
            User newUser = new User(username, nickname, state, auth); //remotely added
            try
            {
                //todo(0) fix the obvious bug here (append and dont introdude a new line)
                StreamWriter writer = File.AppendText(SessionSettings.usersfile);
                writer.WriteLine(); //extra!
                writer.WriteLine(username + "|" + nickname + "|" + auth.ToString());
                writer.Flush();
                writer.Close();
                result = true;
            }
            catch (Exception ex)
            {
                Logger.LogInformation("error adding user to usersfile");
                Logger.LogException(ex);
                result = false;
            }
            return result;
        }