Example #1
0
        public ProfilePluginManager(ClientProfile profile, BattleNetClient client, ProfileDocument view)
        {
            m_profile = profile;
            m_client = client;
            m_view = view;

            m_clientPlugins = new List<ISingleClientPlugin>();
            m_multiClientPlugins = new List<IMultiClientPlugin>();
            m_clientPluginSettings = new Dictionary<ISingleClientPlugin, Dictionary<string, string>>();

            EnumeratePlugins(profile.PluginSettings);
        }
Example #2
0
        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();
            }
        }