Exemplo n.º 1
0
        // Parses player summaries.
        private static PlayerSummary Parse(XElement xml)
        {
            if (xml == null)
            {
                return(null);
            }

            ElementParser parser = new ElementParser(xml);
            PlayerSummary result = new PlayerSummary
            {
                Id             = parser.GetAttributeLong("steamid"),
                DisplayName    = parser.GetAttributeString("personaname"),
                Url            = parser.GetAttributeString("profileurl"),
                AvatarSmall    = parser.GetAttributeString("avatar"),
                AvatarMedium   = parser.GetAttributeString("avatarmedium"),
                AvatarLarge    = parser.GetAttributeString("avatarfull"),
                Status         = parser.GetAttributeInteger("personastate"),
                Visibility     = parser.GetAttributeInteger("communityvisibilitystate"),
                Configured     = parser.GetAttributeBoolean("profilestate"),
                LastSeen       = parser.GetAttributeDate("lastlogoff"),
                AllowsComments = parser.GetAttributeBoolean("commentpermission"),
                Name           = parser.GetAttributeString("realname"),
                PrimaryClan    = parser.GetAttributeLong("primaryclanid"),
                CreationDate   = parser.GetAttributeDate("timecreated"),
                AppId          = parser.GetAttributeInteger("gameid"),
                AppInfo        = parser.GetAttributeString("gameextrainfo"),
                ServerIp       = parser.GetAttributeIpAdress("gameserverip"),
                ServerPort     = parser.GetAttributePort("gameserverip"),
                CityId         = parser.GetAttributeInteger("loccityid"),
                Country        = parser.GetAttributeString("loccountrycode"),
                State          = parser.GetAttributeString("locstatecode")
            };

            return(result);
        }
Exemplo n.º 2
0
        // Parse xml formatted news article to an object.
        private static NewsArticle Parse(XElement xml)
        {
            if (xml == null)
            {
                return(null);
            }

            ElementParser parser = new ElementParser(xml);
            NewsArticle   result = new NewsArticle
            {
                Gid        = parser.GetAttributeLong("gid"),
                AppId      = parser.GetAttributeInteger("appid"),
                Title      = parser.GetAttributeString("title"),
                Url        = parser.GetAttributeString("url"),
                Content    = parser.GetAttributeString("contents"),
                Author     = parser.GetAttributeString("author"),
                FeedLabel  = parser.GetAttributeString("feedlabel"),
                FeedType   = parser.GetAttributeString("feed_type"),
                FeedName   = parser.GetAttributeString("feedname"),
                Date       = parser.GetAttributeDate("date"),
                IsExternal = parser.GetAttributeBoolean("is_external_url")
            };

            return(result);
        }
Exemplo n.º 3
0
        // Parses id getter results.
        private static long Parse(XElement xml)
        {
            if (xml == null)
            {
                return(-1);
            }

            ElementParser parser = new ElementParser(xml);

            return(parser.GetAttributeLong("steamid"));
        }
Exemplo n.º 4
0
        // Parses the xml formatted verbose owned game info to an object.
        private static Friend Parse(XElement xml)
        {
            if (xml == null)
            {
                return(null);
            }

            ElementParser parser = new ElementParser(xml);

            Friend result = new Friend
            {
                Id           = parser.GetAttributeLong("steamid"),
                Date         = parser.GetAttributeDate("friend_since"),
                Relationship = GetRelationshipInt(parser.GetAttributeString("relationship"))
            };

            return(result);
        }