Пример #1
0
        private void RegisterConextAction(Command t, CommandContextAction cca)
        {
            String subDir = t.GetType().Namespace;
            var    ccc    = GetCommandContextMenu(subDir);

            ccc.AddSubCommand(cca);
            var ccc2 = GetCommandContextMenu(t.Category.ToString());

            if (ccc2 != ccc)
            {
                ccc2.AddSubCommand(cca);
            }
            //instance.TabConsole.RegisterContextAction(cca);
        }
Пример #2
0
        private void AddCommand(Command renCmd, Type type, Type use)
        {
            lock (Actions)
            {
                if (!Actions.Add(renCmd))
                {
                    return;
                }

                CommandContextAction cca = new CommandContextAction(instance, Plugin)
                {
                    Label       = renCmd.Name,
                    Handler     = null,
                    ContextType = type,
                    act         = renCmd,
                    useType     = use
                };
                RegisterConextAction(renCmd, cca);
            }
        }
Пример #3
0
        public void StartPlugin0(RadegastInstance inst)
        {
            RadegastInstance = inst;
            Control.CheckForIllegalCrossThreadCalls = false;
            AddRadegastEvents();
            CogbotContextMenuListener = new CogbotContextMenuListener();
            CogbotNoticeuListener     = new CogbotNotificationListener();
            if (ClientManagerConfig.UsingRadegastFromCogbot)
            {
                // just unregister events for now
                inst.Netcom.Dispose();
                clientManager = ClientManager.SingleInstance ?? new ClientManager();
                // _theBot = clientManager.LastBotClient;
            }
            else
            {
                if (!plugInitCalledEver)
                {
                    CogbotGUI.GlobalRadegastInstance = inst;
                }
                ClientManagerConfig.UsingCogbotFromRadegast = true;
                clientManager = ClientManager.SingleInstance ?? new ClientManager();
            }
            BotClient bc = clientManager.EnsureBotByGridClient(inst.Client);

            bc.TheRadegastInstance = inst;
            _theBot = bc;
            cogbotRadegastInterpreter = new CogbotRadegastInterpreter(this);
            RadegastInstance.CommandsManager.LoadInterpreter(cogbotRadegastInterpreter);
            _commandContextAction = new CommandContextAction(inst, this);
            _commandContextAction.ScanCogbotMenu();
            inst.TabConsole.RegisterContextAction(_commandContextAction);
            _aspectContextAction = new AspectContextAction(inst, this);
            inst.TabConsole.RegisterContextAction(_aspectContextAction);
            _simUsageContextAction = new SimUsageContextAction(inst, this);
            inst.TabConsole.RegisterContextAction(_simUsageContextAction);

            //if (ClientManager.UsingRadgastFromCogbot) return;
            inst.Client.Settings.MULTIPLE_SIMS = true;
            clientManager.outputDelegate       = System.Console.Out.WriteLine;
            GUIInvoke(() => SetupRadegastGUI(inst));
            DLRConsole.SafelyRun(() => clientManager.ProcessCommandArgs());
            chatConsole.StartWriter();
            if (!bc.IsLoggedInAndReady)
            {
                TheBot.InvokeNext("Re-enable login button", () =>
                {
                    TheBot.DebugWriteLine("SetLoginButton = r-enabled");
                    SetLoginButton(OldLoginText, true);
                });
            }
            if (plugInitCalledEver)
            {
                return;
            }
            plugInitCalledEver = true;
            if (ClientManagerConfig.StartLispThreadAtPluginInit)
            {
                RunClientManagerStartupLisp();
            }
        }
Пример #4
0
 public void AddSubCommand(CommandContextAction command)
 {
     SubCommands.Add(command);
 }
Пример #5
0
 private void RegisterConextAction(Command t, CommandContextAction cca)
 {            
     String subDir = t.GetType().Namespace;
     var ccc = GetCommandContextMenu(subDir);
     ccc.AddSubCommand(cca);
     var ccc2 = GetCommandContextMenu(t.Category.ToString());
     if (ccc2!=ccc) ccc2.AddSubCommand(cca);
     //instance.TabConsole.RegisterContextAction(cca);
 }
Пример #6
0
        private void AddCommand(Command renCmd, Type type, Type use)
        {
            lock (Actions)
            {

                if (!Actions.Add(renCmd)) return;

                CommandContextAction cca = new CommandContextAction(instance, Plugin)
                                               {
                                                   Label = renCmd.Name,
                                                   Handler = null,
                                                   ContextType = type,
                                                   act = renCmd,
                                                   useType = use
                                               };
                RegisterConextAction(renCmd,cca);
            }
        }
Пример #7
0
 public void AddSubCommand(CommandContextAction command)
 {
     SubCommands.Add(command);
 }
Пример #8
0
        public void StartPlugin0(RadegastInstance inst)
        {
            RadegastInstance = inst;
            Control.CheckForIllegalCrossThreadCalls = false;
            AddRadegastEvents();
            CogbotContextMenuListener = new CogbotContextMenuListener();
            CogbotNoticeuListener = new CogbotNotificationListener();
            if (ClientManagerConfig.UsingRadegastFromCogbot)
            {
                // just unregister events for now
                inst.Netcom.Dispose();
                clientManager = ClientManager.SingleInstance ?? new ClientManager();
                // _theBot = clientManager.LastBotClient;
            }
            else
            {
                if (!plugInitCalledEver)
                {
                    CogbotGUI.GlobalRadegastInstance = inst;
                }
                ClientManagerConfig.UsingCogbotFromRadegast = true;
                clientManager = ClientManager.SingleInstance ?? new ClientManager();
            }
            BotClient bc = clientManager.EnsureBotByGridClient(inst.Client);
            bc.TheRadegastInstance = inst;
            _theBot = bc;
            cogbotRadegastInterpreter = new CogbotRadegastInterpreter(this);
            RadegastInstance.CommandsManager.LoadInterpreter(cogbotRadegastInterpreter);
            _commandContextAction = new CommandContextAction(inst, this);
            _commandContextAction.ScanCogbotMenu();
            inst.TabConsole.RegisterContextAction(_commandContextAction);
            _aspectContextAction = new AspectContextAction(inst, this);
            inst.TabConsole.RegisterContextAction(_aspectContextAction);
            _simUsageContextAction = new SimUsageContextAction(inst, this);
            inst.TabConsole.RegisterContextAction(_simUsageContextAction);

            //if (ClientManager.UsingRadgastFromCogbot) return;
            inst.Client.Settings.MULTIPLE_SIMS = true;
            clientManager.outputDelegate = System.Console.Out.WriteLine;
            GUIInvoke(() => SetupRadegastGUI(inst));
            DLRConsole.SafelyRun(() => clientManager.ProcessCommandArgs());
            chatConsole.StartWriter();
            if (!bc.IsLoggedInAndReady)
            {
                TheBot.InvokeNext("Re-enable login button", () =>
                                                                {
                                                                    TheBot.DebugWriteLine("SetLoginButton = r-enabled");
                                                                    SetLoginButton(OldLoginText, true);
                                                                });
            }
            if (plugInitCalledEver)
            {
                return;
            }
            plugInitCalledEver = true;
            if (ClientManagerConfig.StartLispThreadAtPluginInit)
            {
                RunClientManagerStartupLisp();
            }
        }