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); }
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); }
public LinkHandler(PacketIF pif) { this.packetIF = pif; Dictionary<String, CmdEntry> dict = new Dictionary<String, CmdEntry>(); commandEntry = new CmdEntry(dict, this); }