Exemplo n.º 1
0
 void Client_ProfileLookupFailed(object sender, ProfileLookupFailedEventArgs e)
 {
     if (__profileLookupFailed != null)
     {
         __profileLookupFailed.Call(_host.ClientHost, ConvObj(e));
     }
 }
Exemplo n.º 2
0
        private void HandleProfile(ParseData pd)
        {
            DataReader dr     = new DataReader(pd.Data);
            int        cookie = dr.ReadInt32();

            if (!m_warcraftProfileRequests.ContainsKey(cookie))
            {
                Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "Unable to locate profile request with cookie {0:x2}", cookie));
                return;
            }
            WarcraftProfileEventArgs args = m_warcraftProfileRequests[cookie];

            byte success = dr.ReadByte();

            if (success != 0)
            {
                m_warcraftProfileRequests.Remove(cookie);
                ProfileLookupFailedEventArgs profileFailed = new ProfileLookupFailedEventArgs(args.Username, args.Product)
                {
                    EventData = pd
                };
                OnProfileLookupFailed(profileFailed);
                return;
            }

            string desc     = dr.ReadCString();
            string location = dr.ReadCString();
            string tag      = dr.ReadDwordString(0);

            WarcraftProfile profile = new WarcraftProfile(desc, location, tag);

            args.Profile = profile;
            if (!string.IsNullOrEmpty(tag))
            {
                BncsPacket pck = new BncsPacket((byte)BncsPacketId.ClanMemberInformation);
                pck.InsertInt32(cookie);
                pck.InsertDwordString(tag, 0);
                pck.InsertCString(args.Username);
                Send(pck);
            }
            else
            {
                BncsPacket pck = new BncsPacket((byte)BncsPacketId.WarcraftGeneral);
                pck.InsertByte((byte)WarcraftCommands.UserInfoRequest);
                pck.InsertInt32(cookie);
                pck.InsertCString(args.Username);
                pck.InsertDwordString(args.Product.ProductCode);
                Send(pck);
            }


            BattleNetClientResources.IncomingBufferPool.FreeBuffer(pd.Data);
        }
Exemplo n.º 3
0
        private void HandleClanMemberInformation(ParseData pd)
        {
            DataReader dr     = new DataReader(pd.Data);
            int        cookie = dr.ReadInt32();

            if (!m_warcraftProfileRequests.ContainsKey(cookie))
            {
                Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "Unable to locate profile request with cookie {0:x2}", cookie));
                return;
            }
            WarcraftProfileEventArgs args = m_warcraftProfileRequests[cookie];

            byte success = dr.ReadByte();

            if (success != 0)
            {
                m_warcraftProfileRequests.Remove(cookie);
                ProfileLookupFailedEventArgs profileFailed = new ProfileLookupFailedEventArgs(args.Username, args.Product)
                {
                    EventData = pd
                };
                OnProfileLookupFailed(profileFailed);
                return;
            }

            string   clanName = dr.ReadCString();
            ClanRank rank     = (ClanRank)dr.ReadByte();
            DateTime joined   = DateTime.FromFileTime(dr.ReadInt64());

            args.Clan = new ClanProfile(clanName, rank, joined);

            BncsPacket pck = new BncsPacket((byte)BncsPacketId.WarcraftGeneral);

            pck.InsertByte((byte)WarcraftCommands.ClanInfoRequest);
            pck.InsertInt32(cookie);
            pck.InsertDwordString(args.Profile.ClanTag, 0);
            pck.InsertDwordString(args.Product.ProductCode);
            Send(pck);

            BattleNetClientResources.IncomingBufferPool.FreeBuffer(pd.Data);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Raises the ProfileLookupFailed event.
        /// </summary>
        /// <remarks>
        /// <para>Only high-priority events are invoked immediately; others are deferred.  For more information, see <see>ProfileLookupFailed</see>.</para>
        /// </remarks>
        /// <param name="e">The event arguments.</param>
        /// <seealso cref="ProfileLookupFailed" />
        protected virtual void OnProfileLookupFailed(ProfileLookupFailedEventArgs e)
        {
            foreach (ProfileLookupFailedEventHandler eh in __ProfileLookupFailed[Priority.High])
            {
                try
                {
                    eh(this, e);
                }
                catch (Exception ex)
                {
                    ReportException(
                        ex,
                        new KeyValuePair <string, object>("delegate", eh),
                        new KeyValuePair <string, object>("Event", "ProfileLookupFailed"),
                        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 (ProfileLookupFailedEventHandler eh in __ProfileLookupFailed[Priority.Normal])
                {
                    try
                    {
                        eh(this, e);
                    }
                    catch (Exception ex)
                    {
                        ReportException(
                            ex,
                            new KeyValuePair <string, object>("delegate", eh),
                            new KeyValuePair <string, object>("Event", "ProfileLookupFailed"),
                            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 (ProfileLookupFailedEventHandler eh in __ProfileLookupFailed[Priority.Low])
                    {
                        try
                        {
                            eh(this, e);
                        }
                        catch (Exception ex)
                        {
                            ReportException(
                                ex,
                                new KeyValuePair <string, object>("delegate", eh),
                                new KeyValuePair <string, object>("Event", "ProfileLookupFailed"),
                                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);
                });
            });
        }
Exemplo n.º 5
0
 public void OnProfileLookupFailed(ProfileLookupFailedEventArgs e)
 {
     m_host.OnProfileLookupFailed(e);
 }