Exemple #1
0
 public void UnregisterCommand(MatchCommand mtcCommand) {
     lock (MatchedInGameCommandsLocker) {
         if (MatchedInGameCommands.ContainsKey(mtcCommand.ToString()) == true) {
             MatchedInGameCommands.Remove(mtcCommand.ToString());
             InvokeOnAllEnabled("OnUnregisteredCommand", mtcCommand);
         }
     }
 }
Exemple #2
0
        // TO DO: Move to seperate command control class with events captured by PluginManager.
        public void RegisterCommand(MatchCommand mtcCommand) {
            lock (MatchedInGameCommandsLocker) {
                if (mtcCommand.RegisteredClassname.Length > 0 && mtcCommand.RegisteredMethodName.Length > 0 && mtcCommand.Command.Length > 0) {
                    if (MatchedInGameCommands.ContainsKey(mtcCommand.ToString()) == true) {
                        if (String.CompareOrdinal(MatchedInGameCommands[mtcCommand.ToString()].RegisteredClassname, mtcCommand.RegisteredClassname) != 0) {
                            WritePluginConsole("^1^bIdentical command registration on class {0} overwriting class {1} command {2}", mtcCommand.RegisteredClassname, MatchedInGameCommands[mtcCommand.ToString()].RegisteredClassname, MatchedInGameCommands[mtcCommand.ToString()].ToString());
                        }

                        MatchedInGameCommands[mtcCommand.ToString()] = mtcCommand;
                    }
                    else {
                        MatchedInGameCommands.Add(mtcCommand.ToString(), mtcCommand);

                        InvokeOnAllEnabled("OnRegisteredCommand", mtcCommand);
                    }
                }
            }
        }