Пример #1
0
        private void plugin_OnRemovedFromManager(Plugin sender, PluginManager manager)
        {
            Event.Callback <Plugin, PluginManager> callback;
            int i;
            Func <Command.ChatCommand, bool> func = null;

            Command.ConsoleCommand[] array = (
                from c in this.consoleCommands.Values
                where c.Callback.Plugin == sender
                select c).ToArray <Command.ConsoleCommand>();
            for (i = 0; i < (int)array.Length; i++)
            {
                this.RemoveConsoleCommand(array[i]);
            }
            Dictionary <!0, !1> .ValueCollection values = this.chatCommands.Values;
            Func <Command.ChatCommand, bool>     func1  = func;

            if (func1 == null)
            {
                Func <Command.ChatCommand, bool> plugin = (Command.ChatCommand c) => c.Plugin == sender;
                Func <Command.ChatCommand, bool> func2  = plugin;
                func  = plugin;
                func1 = func2;
            }
            Command.ChatCommand[] chatCommandArray = values.Where <Command.ChatCommand>(func1).ToArray <Command.ChatCommand>();
            for (i = 0; i < (int)chatCommandArray.Length; i++)
            {
                this.RemoveChatCommand(chatCommandArray[i]);
            }
            if (this.pluginRemovedFromManager.TryGetValue(sender, out callback))
            {
                callback.Remove();
                this.pluginRemovedFromManager.Remove(sender);
            }
        }