private void EnsureUserExists(string userName)
 {
     if (!UsersByName.ContainsKey(userName))
     {
         var user = new User(userName);
         UsersByName.Add(userName, user);
     }
 }
Exemplo n.º 2
0
        // USERS
        public virtual User GetOrCreateUser(string id, string name)
        {
            User u;

            if (!UsersByID.TryGetValue(id, out u))
            {
                u = new User()
                {
                    Name = name,
                    ID   = id
                };
                UsersByID[id] = u;
                if (!UsersByName.ContainsKey(name.ToLower()))
                {
                    UsersByName[name.ToLower()] = u;
                }
            }
            u.Name = name;
            return(u);
        }