Пример #1
0
        public string AddAlias(string newAlias, string oldName)
        {
            UserAliasGroup testGroup;
                bool newKeyExists = AliasRegistry.TryGetValue(newAlias, out testGroup);
                if(newKeyExists)
                    return String.Format("That alias is already assigned to {0}", testGroup.GetUserAliases().First());

                bool oldKeyExists = AliasRegistry.TryGetValue(oldName, out testGroup);
                if(!oldKeyExists)
                {
                    UserAliasGroup newAliasGroup = new UserAliasGroup(oldName, newAlias);
                    AliasRegistry.Add(newAlias, newAliasGroup);
                    AliasRegistry.Add(oldName, newAliasGroup);
                    return String.Format("New alias group created for {0} that includes {1}", oldName, newAlias);
                }
                else{
                    if(testGroup.AddAlias(newAlias)) {
                        AliasRegistry.Add(newAlias, testGroup);
                        return String.Format("Alias {0} added to group that includes {1}", newAlias, oldName);
                    }
                }

                return "Something very bad has happened";
        }
Пример #2
0
 public bool GetAliasGroup(string nick, out UserAliasGroup aliasGroup)
 {
     return AliasRegistry.TryGetValue(nick, out aliasGroup);
 }