Exemple #1
0
        public ChannelList(BattleNetClient client)
            : this()
        {
            m_client = client;

            ProcessEventSetup();

            m_resourceProvider = ProfileResourceProvider.GetForClient(client);
        }
Exemple #2
0
        /// <summary>
        /// Creates a new <see>ChatDocument</see> to handle the specified client.
        /// </summary>
        /// <param name="client">The client to handle.</param>
        public ChatDocument(BattleNetClient client)
            : this()
        {
            m_client = client;
            m_prp = ProfileResourceProvider.GetForClient(client);
            m_profile = client.Settings as ClientProfile;

            SetupEventRegistration();
        }
Exemple #3
0
        /// <summary>
        /// Creates a new <see>ChatDocument</see> to handle the specified client.
        /// </summary>
        /// <param name="client">The client to handle.</param>
        public ChatDocument(BattleNetClient client)
            : this()
        {
            m_client  = client;
            m_prp     = ProfileResourceProvider.GetForClient(client);
            m_profile = client.Settings as ClientProfile;

            SetupEventRegistration();
        }
Exemple #4
0
        public ChannelList(BattleNetClient client)
            : this()
        {
            m_client = client;

            ProcessEventSetup();

            m_resourceProvider = ProfileResourceProvider.GetForClient(client);
        }
Exemple #5
0
        public ClanList(BattleNetClient client)
            : this()
        {
            m_client = client;

            m_prp = ProfileResourceProvider.GetForClient(client);

            client.ClanMemberListReceived += new ClanMemberListEventHandler(client_ClanMemberListReceived);
            client.ClanMembershipReceived += new ClanMembershipEventHandler(client_ClanMembershipReceived);
        }
Exemple #6
0
        public ClanList(BattleNetClient client)
            : this()
        {
            m_client = client;

            m_prp = ProfileResourceProvider.GetForClient(client);

            client.ClanMemberListReceived += new ClanMemberListEventHandler(client_ClanMemberListReceived);
            client.ClanMembershipReceived += new ClanMembershipEventHandler(client_ClanMembershipReceived);
        }
        /// <summary>
        /// Registers a provider for the specified connection and returns the provider.
        /// </summary>
        /// <param name="client">The client connection to register.</param>
        /// <returns>A <see>ProfileResourceProvider</see> if the profile was newly registered; or <see langword="null" /> if the profile
        /// was already registered.</returns>
        public static ProfileResourceProvider RegisterProvider(BattleNetClient client)
        {
            ProfileResourceProvider provider = null;
            if (!s_providers.ContainsKey(client))
            {
                provider = new ProfileResourceProvider(client);
                s_providers.Add(client, provider);
            }

            return provider;
        }
        /// <summary>
        /// Registers a provider for the specified connection and returns the provider.
        /// </summary>
        /// <param name="client">The client connection to register.</param>
        /// <returns>A <see>ProfileResourceProvider</see> if the profile was newly registered; or <see langword="null" /> if the profile
        /// was already registered.</returns>
        public static ProfileResourceProvider RegisterProvider(BattleNetClient client)
        {
            ProfileResourceProvider provider = null;

            if (!s_providers.ContainsKey(client))
            {
                provider = new ProfileResourceProvider(client);
                s_providers.Add(client, provider);
            }

            return(provider);
        }
        /// <summary>
        /// Unregisters a profile and cleans up its resources.
        /// </summary>
        /// <param name="client">The client to unregister.</param>
        public static void UnregisterProvider(BattleNetClient client)
        {
            if (!s_providers.ContainsKey(client))
            {
                return;
            }

            ProfileResourceProvider provider = s_providers[client];

            s_providers.Remove(client);

            provider.Dispose();
        }
Exemple #10
0
        void EnteredChat(object sender, EnteredChatEventArgs e)
        {
            Product clientProduct = Product.GetByProductCode(m_client.Settings.Client.ToUpperInvariant());
            string  imgID         = m_prp.Icons.GetImageIdFor(UserFlags.None, UserStats.CreateDefault(clientProduct));
            Image   userImg       = ProfileResourceProvider.GetForClient(m_client).Icons.GetImageFor(UserFlags.None, UserStats.CreateDefault(clientProduct));

            chat.AddChat(new ChatNode("Entered chat as ", CssClasses.EnteringChat),
                         new ImageChatNode(string.Concat(imgID, ".jpg"),
                                           userImg, clientProduct.Name),
                         new ChatNode(e.UniqueUsername, CssClasses.UsernameOther));
            m_userName    = e.UniqueUsername;
            m_inChat      = true;
            m_enteredChat = DateTime.Now;
        }
Exemple #11
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();
            }
        }