Esempio n. 1
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);
        }
Esempio n. 2
0
        public WarcraftProfileDisplayDocument(WarcraftProfile profile)
            : this()
        {
            foreach (var at in profile.ArrangedTeams)
            {
                ArrangedTeamDisplay atd = new ArrangedTeamDisplay(at);
                this.arrTeamStats.Controls.Add(atd);
            }

            foreach (var rec in profile.LadderRecords)
            {
                RecordDisplay rd = new RecordDisplay(rec);
                this.ladderStats.Controls.Add(rd);
            }

            this.clanName.Text = profile.ClanTag;
            this.personalStats.BindToStats(profile.RaceRecords);
            this.about.Text = profile.Description;
        }