private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (listView1.SelectedItems.Count < 0)
         return;
     CommandHandler handler = (CommandHandler)listView1.SelectedItems[0].Tag;
     SelectedHandler = handler;
     this.DialogResult = DialogResult.OK;
 }
Пример #2
0
 public RegisteredCommand(string _flag, CommandHandler h)
 {
     OnException = h.Parent.GetExceptionCallback();
     Flag = _flag;
     Handler = h;
     FlagIsRegex = false;
     FlagIsCaseSensitive = false;
     IsModOnly = false;
 }
Пример #3
0
 public AddCommandForm(CommandHandler[] _handlers, RegisteredCommand currentCommand)
 {
     InitializeComponent();
     this.Text = "Editing Command";
     handlers = _handlers;
     FlagTextbox.Text = currentCommand.Flag;
     modOnly.Checked = currentCommand.IsModOnly;
     Isregex.Checked = currentCommand.FlagIsRegex;
     CaseSensitive.Checked = currentCommand.FlagIsCaseSensitive;
     LoadHandler(currentCommand.Handler);
     LoadUserInput(currentCommand.UserDataInput);
 }
Пример #4
0
 public AddCommandForm(CommandHandler[] _handlers)
 {
     handlers = _handlers;
     InitializeComponent();
     LoadUserInput();
 }
Пример #5
0
 void LoadHandler(CommandHandler handler)
 {
     if (handler == null)
         return;
     SelectedHandler = handler;
     if (SelectedHandler == null)
         return;
     if (SelectedHandler.Command.Paramiter != ParamiterType.None)
         Isregex.Checked = false;
     Isregex.Enabled = (SelectedHandler.Command.Paramiter == ParamiterType.None);
     CommandName.Text = SelectedHandler.Command.Name;
 }
Пример #6
0
        public MainWindow()
        {
            using (LoadBotForm lbf = new LoadBotForm())
            {
                if(lbf.ShowDialog() != DialogResult.OK)
                {
                    Environment.Exit(0);
                    return;
                }
                bot = new IRCBot(lbf.BotLogin);
            }
            InitializeComponent();

            DirectoryInfo PluginDirectory;
            try
            {
                PluginDirectory = new DirectoryInfo("Plugins");
                if (!PluginDirectory.Exists)
                    PluginDirectory.Create();
            }
            catch
            {
                MessageBox.Show("No access to \"Plugin\" Directory.");
                return;
            }
            foreach (FileInfo pluginFile in PluginDirectory.GetFiles("*.dll"))
            {
                try
                {
                    LoadedPlugin plugin = PluginHandler.LoadPlugin(pluginFile.FullName);
                    plugin.OnException += Plugin_OnException;
                    if (!PluginIDList.Add(plugin.PluginID))
                        throw new Exception("Duplicate id");

                    HandlerBundle handlers = new HandlerBundle();

                    handlers.Bot = new BotHandler(plugin);
                    handlers.Bot.OnException += OnException;
                    handlers.Bot.OnSayMessage += Bot_OnSayMessage;

                    handlers.UI = new BotUIHandler(plugin);
                    handlers.UI.OnTabAdd += UI_OnTabAdd;

                    plugin.Initilze(handlers);

                    foreach (var command in plugin.Details.LoadedCommands)
                    {
                        var handler = new CommandHandler(plugin, command);
                        if (!HandlerList.ContainsKey(handler.ID))
                        {
                            HandlerList.Add(handler.ID, handler);
                        }
                    }

                    PluginDisplayControl display = new PluginDisplayControl(plugin);
                    display.Parent = PluginDisplayPanel;
                    display.Width = PluginDisplayPanel.Width;
                    display.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
                    display.Location = new Point(0, PluginList.Count * display.Height);
                    PluginDisplayPanel.Controls.Add(display);

                    PluginList.Add(plugin);
                }
                catch
                {
                    Debug.WriteLine("Error on file {0}", pluginFile.Name);
                }

                LoadSettings();
            }
        }
 public PluginHandlerListForm(CommandHandler[] handlerList)
 {
     InitializeComponent();
     handlers = handlerList;
     LoadPlugins("", true);
 }