Exemple #1
0
            public Command Create(string name, string syntax, string help, UseHandler use)
            {
                int index = name.LastIndexOf(' ');

                if (index != -1)
                {
                    string  cmd        = name.Substring(0, index);
                    Command supCommand = this[cmd];
                    if (supCommand == null)
                    {
                        throw new Exception("Command '" + cmd + "' doesn't exist.");
                    }
                }
                Command command = new Command(name, syntax, help, use);
                Command old     = this[name];

                if (old != null)
                {
                    commands.Remove(name.ToLower());
                    foreach (Group group in server.Groups.All)
                    {
                        if (group.Commands.Contains(old))
                        {
                            group.Commands.Remove(old);
                            group.Commands.Add(command);
                        }
                    }
                }
                commands.Add(name.ToLower(), command);
                return(command);
            }
Exemple #2
0
 private Command(string name,string syntax,string help,UseHandler use)
 {
     this.name = name;
     this.syntax = "/"+name;
     if (syntax!="") { this.syntax += " "+syntax; }
     this.help = this.syntax+" - "+help;
     this.use = use;
 }
Exemple #3
0
 private Command(string name, string syntax, string help, UseHandler use)
 {
     this.name   = name;
     this.syntax = "/" + name;
     if (syntax != "")
     {
         this.syntax += " " + syntax;
     }
     this.help = this.syntax + " - " + help;
     this.use  = use;
 }
Exemple #4
0
        public void Initialize()
        {
            _person = new Person
            {
                Id        = Guid.Parse("7AEC12CD-FD43-49DD-A2AB-3CDD19A3A5F4"),
                Birthday  = new DateTimeOffset(new DateTime(1980, 1, 1)),
                Firstname = "John",
                Lastname  = "Doe"
            };

            _linkBuilderMock = new Mock <ILinkBuilder>(MockBehavior.Strict);
            _handler         = new UseHandler();
        }
Exemple #5
0
 public Command Create(string name,string syntax,string help,UseHandler use)
 {
     int index = name.LastIndexOf(' ');
     if (index!=-1) {
         string cmd = name.Substring(0,index);
         Command supCommand = this[cmd];
         if (supCommand==null) { throw new Exception("Command '"+cmd+"' doesn't exist."); }
     } Command command = new Command(name,syntax,help,use);
     Command old = this[name];
     if (old!=null) {
         commands.Remove(name.ToLower());
         foreach (Group group in server.Groups.All)
             if (group.Commands.Contains(old)) {
             group.Commands.Remove(old);
             group.Commands.Add(command);
         }
     } commands.Add(name.ToLower(),command);
     return command;
 }