public JinxBotClient(ClientProfile profile) { m_activePlugins = new Dictionary<ProfilePluginConfiguration, IJinxBotPlugin>(); if (profile.SimulateClient) m_client = new SimulatedBattleNetClient(profile); else m_client = new BattleNetClient(profile); m_profile = profile; m_resourceProvider = ProfileResourceProvider.RegisterProvider(m_client); m_cmdTranslator = new CommandTranslator(this); bool hasSetCommandQueue = false; if (m_database == null) m_database = new JinxBotDefaultDatabase(); // finally, initialize ui m_window = new ProfileDocument(this); // initialize plugins m_commandHandlers = new List<ICommandHandler>(); foreach (ProfilePluginConfiguration pluginConfig in profile.PluginSettings) { hasSetCommandQueue = ProcessPlugin(hasSetCommandQueue, pluginConfig); } ProfilePluginConfiguration jsConfig = new ProfilePluginConfiguration { Assembly = "JinxBot.Plugins.Script.dll", Name = "JavaScript Plugin", Settings = new ProfilePluginSettingConfiguration[0], Type = "JinxBot.Plugins.Script.JinxBotJavaScriptPlugin" }; hasSetCommandQueue = ProcessPlugin(hasSetCommandQueue, jsConfig); if (!hasSetCommandQueue) { m_client.CommandQueue = new TimedMessageQueue(); } }
private void LoadOrDisplayProfile(ClientProfile cp) { if (cp != null) { if (m_activeClients.ContainsKey(cp)) { m_activeClients[cp].ProfileDocument.Show(); } else { try { JinxBotClient client = new JinxBotClient(cp); client.Client.Connected += client_Connected; client.Client.Disconnected += client_Disconnected; m_activeClients.Add(cp, client); client.ProfileDocument.Show(this.dock); ThumbnailPreviewManager.AddThumbnail(client.ProfileDocument); } catch (BattleNetSettingsErrorsException ex) { ProfileLoadErrorDialog dlg = new ProfileLoadErrorDialog(ex); dlg.ShowDialog(); } } } }