Пример #1
0
        public void UpdateFriend(Friend steamid)
        {
            Friend = steamid;

            nameLbl.Text   = steamid.GetName();
            statusLbl.Text = steamid.GetStatus();
            gameLbl.Text   = steamid.GetGameName();

            if (steamid.IsRequestingFriendship())
            {
                btnAccept.Visible = true;
                btnDeny.Visible   = true;
            }
            else
            {
                btnAccept.Visible = false;
                btnDeny.Visible   = false;
            }

            nameLbl.ForeColor = statusLbl.ForeColor = gameLbl.ForeColor = Util.GetStatusColor(steamid);

            byte[] avatarHash = Steam3.SteamFriends.GetFriendAvatar(steamid.SteamID);
            bool   validHash  = avatarHash != null && !Util.IsZeros(avatarHash);

            if ((AvatarHash == null && !validHash && avatarBox.Image != null) || (AvatarHash != null && AvatarHash.SequenceEqual(avatarHash)))
            {
                // avatar is already up to date, no operations necessary
            }
            else if (validHash)
            {
                AvatarHash = avatarHash;
                CDNCache.DownloadAvatar(steamid.SteamID, avatarHash, AvatarDownloaded);
            }
            else
            {
                AvatarHash      = null;
                avatarBox.Image = ComposeAvatar(this.Friend, null);
            }
        }
Пример #2
0
        private static int compareFriends(Friend a, Friend b)
        {
            if (a == b)
            {
                return(0);
            }

            int rankA = rankFriend(a);
            int rankB = rankFriend(b);

            if (rankA < rankB)
            {
                return(-1);
            }
            else if (rankA > rankB)
            {
                return(1);
            }
            else
            {
                return(a.GetName().CompareTo(b.GetName()));
            }
        }
Пример #3
0
        public void UpdateFriend( Friend steamid )
        {
            Friend = steamid;

            nameLbl.Text = steamid.GetName();
            statusLbl.Text = steamid.GetStatus();
            gameLbl.Text = steamid.GetGameName();

            if ( steamid.IsRequestingFriendship() )
            {
                btnAccept.Visible = true;
                btnDeny.Visible = true;
            }
            else
            {
                btnAccept.Visible = false;
                btnDeny.Visible = false;
            }

            nameLbl.ForeColor = statusLbl.ForeColor = gameLbl.ForeColor = Util.GetStatusColor( steamid );

            byte[] avatarHash = Steam3.SteamFriends.GetFriendAvatar( steamid.SteamID );
            bool validHash = avatarHash != null && !Util.IsZeros( avatarHash );

            if ((AvatarHash == null && !validHash && avatarBox.Image != null) || (AvatarHash != null && AvatarHash.SequenceEqual(avatarHash)))
            {
                // avatar is already up to date, no operations necessary
            }
            else if ( validHash )
            {
                AvatarHash = avatarHash;
                CDNCache.DownloadAvatar(steamid.SteamID, avatarHash, AvatarDownloaded);
            }
            else
            {
                AvatarHash = null;
                avatarBox.Image = ComposeAvatar( this.Friend, null );
            }
        }
Пример #4
0
        private static int compareFriends(Friend a, Friend b)
        {
            if (a == b)
                return 0;

            int rankA = rankFriend(a);
            int rankB = rankFriend(b);

            if (rankA < rankB)
                return -1;
            else if (rankA > rankB)
                return 1;
            else
                return a.GetName().CompareTo(b.GetName());
        }