OSDN Git Service

Added RemoveCommand() to the CommandManager
authorLatif Khalifa <latifer@streamgrid.net>
Mon, 15 Aug 2011 10:11:05 +0000 (10:11 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Mon, 15 Aug 2011 10:11:05 +0000 (10:11 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@1093 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/Core/Commands/CommandsManager.cs

index bb84930..85e9edc 100644 (file)
@@ -134,6 +134,20 @@ namespace Radegast.Commands
             return cmd;
         }
 
+        public void RemoveCommand(string name)
+        {
+            lock (CommandsLoaded)
+            {
+                if (CommandsByName.ContainsKey(name))
+                {
+                    var cmd = CommandsByName[name];
+                    CommandsLoaded.Remove(cmd);
+                    CommandsByName.Remove(name);
+                    cmd.Dispose();
+                }
+            }
+        }
+
         public void Help(string args, ConsoleWriteLine WriteLine)
         {
             int found = 0;