private void HandleQueryRealms2(PD data)
        {
            DataReader dr = new DataReader(data.Data);
            dr.Seek(4);
            int count = dr.ReadInt32();
            RealmServer[] realms = new RealmServer[count];
            for (int i = 0; i < count; i++)
            {
                dr.Seek(4);
                string title = dr.ReadCString();
                string desc = dr.ReadCString();

                realms[i] = new RealmServer(title, desc);
            }

            AvailableRealmsEventArgs args = new AvailableRealmsEventArgs(realms) { EventData = data };
            OnRealmsRetrieved(args);
        }
Esempio n. 2
0
        private void HandleQueryRealms2(PD data)
        {
            DataReader dr = new DataReader(data.Data);

            dr.Seek(4);
            int count = dr.ReadInt32();

            RealmServer[] realms = new RealmServer[count];
            for (int i = 0; i < count; i++)
            {
                dr.Seek(4);
                string title = dr.ReadCString();
                string desc  = dr.ReadCString();

                realms[i] = new RealmServer(title, desc);
            }

            AvailableRealmsEventArgs args = new AvailableRealmsEventArgs(realms)
            {
                EventData = data
            };

            OnRealmsRetrieved(args);
        }
Esempio n. 3
0
        /// <summary>
        /// Raises the RealmsRetrieved event.
        /// </summary>
        /// <remarks>
        /// <para>Only high-priority events are invoked immediately; others are deferred.  For more information, see <see>RealmsRetrieved</see>.</para>
        /// </remarks>
        /// <param name="e">The event arguments.</param>
        /// <seealso cref="RealmsRetrieved" />
        protected virtual void OnRealmsRetrieved(AvailableRealmsEventArgs e)
        {
            foreach (AvailableRealmsEventHandler eh in __RealmsRetrieved[Priority.High])
            {
                try
                {
                    eh(this, e);
                }
                catch (Exception ex)
                {
                    ReportException(
                        ex,
                        new KeyValuePair <string, object>("delegate", eh),
                        new KeyValuePair <string, object>("Event", "RealmsRetrieved"),
                        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 (AvailableRealmsEventHandler eh in __RealmsRetrieved[Priority.Normal])
                {
                    try
                    {
                        eh(this, e);
                    }
                    catch (Exception ex)
                    {
                        ReportException(
                            ex,
                            new KeyValuePair <string, object>("delegate", eh),
                            new KeyValuePair <string, object>("Event", "RealmsRetrieved"),
                            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 (AvailableRealmsEventHandler eh in __RealmsRetrieved[Priority.Low])
                    {
                        try
                        {
                            eh(this, e);
                        }
                        catch (Exception ex)
                        {
                            ReportException(
                                ex,
                                new KeyValuePair <string, object>("delegate", eh),
                                new KeyValuePair <string, object>("Event", "RealmsRetrieved"),
                                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);
                });
            });
        }
Esempio n. 4
0
        /// <summary>
        /// Raises the RealmsRetrieved event.
        /// </summary>
        /// <remarks>
        /// <para>Only high-priority events are invoked immediately; others are deferred.  For more information, see <see>RealmsRetrieved</see>.</para>
        /// </remarks>
        /// <param name="e">The event arguments.</param>
        /// <seealso cref="RealmsRetrieved" />
        protected virtual void OnRealmsRetrieved(AvailableRealmsEventArgs e)
        {
            foreach (AvailableRealmsEventHandler eh in __RealmsRetrieved[Priority.High])
            {
                try
                {
                    eh(this, e);
                }
                catch (Exception ex)
                {
                    ReportException(
                        ex,
                        new KeyValuePair<string, object>("delegate", eh),
                        new KeyValuePair<string, object>("Event", "RealmsRetrieved"),
                        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 (AvailableRealmsEventHandler eh in __RealmsRetrieved[Priority.Normal])
                {
                    try
                    {
                        eh(this, e);
                    }
                    catch (Exception ex)
                    {
                        ReportException(
                            ex,
                            new KeyValuePair<string, object>("delegate", eh),
                            new KeyValuePair<string, object>("Event", "RealmsRetrieved"),
                            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 (AvailableRealmsEventHandler eh in __RealmsRetrieved[Priority.Low])
                    {
                        try
                        {
                            eh(this, e);
                        }
                        catch (Exception ex)
                        {
                            ReportException(
                                ex,
                                new KeyValuePair<string, object>("delegate", eh),
                                new KeyValuePair<string, object>("Event", "RealmsRetrieved"),
                                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);
                });
            });
        }