コード例 #1
0
        private void HandleLogonRealmEx(PD data)
        {
            DataReader dr = new DataReader(data.Data);

            m_mcpCookie = dr.ReadInt32();
            int status = dr.ReadInt32();

            m_mcpStatus = status;

            if (data.Length > 8)
            {
                m_mcpChunk1 = dr.ReadByteArray(8);
                byte[] ipAddress = dr.ReadByteArray(4);
                m_ip             = new IPAddress(ipAddress);
                m_port           = dr.ReadInt32();
                m_mcpChunk2      = dr.ReadByteArray(48);
                m_uniqueBnetName = dr.ReadCString();

                BattleNetClientResources.IncomingBufferPool.FreeBuffer(data.Data);
            }
            else
            {
                RealmFailedEventArgs args = new RealmFailedEventArgs((RealmFailureReason)status)
                {
                    EventData = data
                };
                OnRealmConnectionFailed(args);
            }
        }
コード例 #2
0
ファイル: McpConnection.Events.cs プロジェクト: Mofsy/jinxbot
        /// <summary>
        /// Raises the RealmConnectionFailed event.
        /// </summary>
        /// <remarks>
        /// <para>Only high-priority events are invoked immediately; others are deferred.  For more information, see <see>RealmConnectionFailed</see>.</para>
        /// </remarks>
        /// <param name="e">The event arguments.</param>
        /// <seealso cref="RealmConnectionFailed" />
        protected virtual void OnRealmConnectionFailed(RealmFailedEventArgs e)
        {
            foreach (RealmFailedEventHandler eh in __RealmConnectionFailed[Priority.High])
            {
                try
                {
                    eh(this, e);
                }
                catch (Exception ex)
                {
                    ReportException(
                        ex,
                        new KeyValuePair<string, object>("delegate", eh),
                        new KeyValuePair<string, object>("Event", "RealmConnectionFailed"),
                        new KeyValuePair<string, object>("param: priority", Priority.High),
                        new KeyValuePair<string, object>("param: this", this),
                        new KeyValuePair<string, object>("param: e", e)
                        );
                }
            }

            ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            {
                foreach (RealmFailedEventHandler eh in __RealmConnectionFailed[Priority.Normal])
                {
                    try
                    {
                        eh(this, e);
                    }
                    catch (Exception ex)
                    {
                        ReportException(
                            ex,
                            new KeyValuePair<string, object>("delegate", eh),
                            new KeyValuePair<string, object>("Event", "RealmConnectionFailed"),
                            new KeyValuePair<string, object>("param: priority", Priority.Normal),
                            new KeyValuePair<string, object>("param: this", this),
                            new KeyValuePair<string, object>("param: e", e)
                            );
                    }
                }
                ThreadPool.QueueUserWorkItem((WaitCallback)delegate
                {
                    foreach (RealmFailedEventHandler eh in __RealmConnectionFailed[Priority.Low])
                    {
                        try
                        {
                            eh(this, e);
                        }
                        catch (Exception ex)
                        {
                            ReportException(
                                ex,
                                new KeyValuePair<string, object>("delegate", eh),
                                new KeyValuePair<string, object>("Event", "RealmConnectionFailed"),
                                new KeyValuePair<string, object>("param: priority", Priority.Low),
                                new KeyValuePair<string, object>("param: this", this),
                                new KeyValuePair<string, object>("param: e", e)
                                );
                        }
                    }
                    FreeArgumentResources(e as BaseEventArgs);
                });
            });
        }
コード例 #3
0
        /// <summary>
        /// Raises the RealmConnectionFailed event.
        /// </summary>
        /// <remarks>
        /// <para>Only high-priority events are invoked immediately; others are deferred.  For more information, see <see>RealmConnectionFailed</see>.</para>
        /// </remarks>
        /// <param name="e">The event arguments.</param>
        /// <seealso cref="RealmConnectionFailed" />
        protected virtual void OnRealmConnectionFailed(RealmFailedEventArgs e)
        {
            foreach (RealmFailedEventHandler eh in __RealmConnectionFailed[Priority.High])
            {
                try
                {
                    eh(this, e);
                }
                catch (Exception ex)
                {
                    ReportException(
                        ex,
                        new KeyValuePair <string, object>("delegate", eh),
                        new KeyValuePair <string, object>("Event", "RealmConnectionFailed"),
                        new KeyValuePair <string, object>("param: priority", Priority.High),
                        new KeyValuePair <string, object>("param: this", this),
                        new KeyValuePair <string, object>("param: e", e)
                        );
                }
            }

            ThreadPool.QueueUserWorkItem((WaitCallback) delegate
            {
                foreach (RealmFailedEventHandler eh in __RealmConnectionFailed[Priority.Normal])
                {
                    try
                    {
                        eh(this, e);
                    }
                    catch (Exception ex)
                    {
                        ReportException(
                            ex,
                            new KeyValuePair <string, object>("delegate", eh),
                            new KeyValuePair <string, object>("Event", "RealmConnectionFailed"),
                            new KeyValuePair <string, object>("param: priority", Priority.Normal),
                            new KeyValuePair <string, object>("param: this", this),
                            new KeyValuePair <string, object>("param: e", e)
                            );
                    }
                }
                ThreadPool.QueueUserWorkItem((WaitCallback) delegate
                {
                    foreach (RealmFailedEventHandler eh in __RealmConnectionFailed[Priority.Low])
                    {
                        try
                        {
                            eh(this, e);
                        }
                        catch (Exception ex)
                        {
                            ReportException(
                                ex,
                                new KeyValuePair <string, object>("delegate", eh),
                                new KeyValuePair <string, object>("Event", "RealmConnectionFailed"),
                                new KeyValuePair <string, object>("param: priority", Priority.Low),
                                new KeyValuePair <string, object>("param: this", this),
                                new KeyValuePair <string, object>("param: e", e)
                                );
                        }
                    }
                    FreeArgumentResources(e as BaseEventArgs);
                });
            });
        }
コード例 #4
0
        private void HandleLogonRealmEx(PD data)
        {
            DataReader dr = new DataReader(data.Data);
            m_mcpCookie = dr.ReadInt32();
            int status = dr.ReadInt32();
            m_mcpStatus = status;

            if (data.Length > 8)
            {
                m_mcpChunk1 = dr.ReadByteArray(8);
                byte[] ipAddress = dr.ReadByteArray(4);
                m_ip = new IPAddress(ipAddress);
                m_port = dr.ReadInt32();
                m_mcpChunk2 = dr.ReadByteArray(48);
                m_uniqueBnetName = dr.ReadCString();

                BattleNetClientResources.IncomingBufferPool.FreeBuffer(data.Data);
            }
            else
            {
                RealmFailedEventArgs args = new RealmFailedEventArgs((RealmFailureReason)status) { EventData = data };
                OnRealmConnectionFailed(args);
            }
        }