コード例 #1
0
        public void addCommand(String command, CmdEntry.CmdEntryFunction func)
        {
            CmdEntry cmd;
            Dictionary<String, CmdEntry> dict = commandEntry.getDictionary();

            if (func == null)
            {
                Dictionary<String, CmdEntry> d = new Dictionary<String, CmdEntry>();
                cmd = new CmdEntry(d, this);
            }
            else
            {
                cmd = new CmdEntry(func, this);
            }
            dict.Add(command, cmd);
        }
コード例 #2
0
        public void addSubCommand(String command, String subcommand, CmdEntry.CmdEntryFunction func)
        {
            Dictionary<String, CmdEntry> dict = this.commandEntry.getDictionary();
            Dictionary<String, CmdEntry> subdict;
            CmdEntry oe = dict[command];
            CmdEntry ne;
            if (oe == null)
            {
                Console.WriteLine("adding subcommand ({0}) to nonexistent command ({1})",
                    subcommand, command);
            }
            subdict = oe.getDictionary();
            if (subdict == null)
            {
                Console.WriteLine("adding subcommand({0}) to bad command ({1})",
                    subcommand, command);
            }

            ne = new CmdEntry(func, this);
            subdict.Add(subcommand, ne);
        }
コード例 #3
0
 public LinkHandler(PacketIF pif)
 {
     this.packetIF = pif;
     Dictionary<String, CmdEntry> dict = new Dictionary<String, CmdEntry>();
     commandEntry = new CmdEntry(dict, this);
 }