Ejemplo n.º 1
0
        public override void ReadXml(XDocument doc)
        {
            if (null != doc.Root)
            {
                Date = doc.Root.GetAttributeValue<string>("date");
                UnixDate = doc.Root.GetAttributeValue<string>("uts");
                Name = doc.Root.GetValue<string>("name");
                Mbid = doc.Root.GetValue<Guid>("mbid");
                Url = doc.Root.GetValue<string>("url");
                Artist = new LfmShortArtistInfo();
                XElement element = doc.Root.Element("artist");
                if (null != element)
                {
                    Artist.Name = element.GetValue<string>("name");
                    Artist.Mbid = element.GetValue<Guid>("mbid");
                    Artist.Url = element.GetValue<string>("url");
                }

                Album = new LfmShortAlbumInfo();
                element = doc.Root.Element("album");
                if (null != element)
                {
                    Album.Name = element.GetValue<string>("name");
                    Album.Mbid = element.GetValue<Guid>("mbid");
                    Album.Url = element.GetValue<string>("url");
                }
            }
        }
Ejemplo n.º 2
0
        public override void ReadXml(XDocument doc)
        {
            if (null != doc.Root)
            {
                XElement element = doc.Root.Element("artist");
                if (null != element)
                {
                    Artist = new LfmShortArtistInfo();
                    if (element.Elements().ToList().Count > 1)
                    {
                        Artist.Name = element.GetValue<string>("name");
                        Artist.Mbid = element.GetValue<Guid>("mbid");
                        Artist.Images = element.ExtracktItems<LfmImage>("image");
                        Artist.Url = element.GetValue<string>("url");
                        Loved = element.GetValue<bool>("loved");
                    }
                    else
                    {
                        Artist.Name = element.Value;
                        Artist.Mbid = element.GetAttributeValue<Guid>("mbid");
                    }
                }

                Name = doc.Root.GetValue<string>("name");
                Streamable = doc.Root.ExtracktItem<Streamable>("streamable");
                Mbid = doc.Root.GetValue<Guid>("mbid");
                element = doc.Root.Element("album");
                if (null != element)
                {
                    Album = new LfmShortAlbumInfo();
                    Album.Name = element.Value;
                    Album.Mbid = element.GetAttributeValue<Guid>("mbid");
                }

                Url = doc.Root.GetValue<string>("url");
                element = doc.Root.Element("date");
                if (null != element)
                {
                    DateTime = new LfmDateTime();
                    DateTime.DateTime = element.Value;
                    DateTime.UnixTime = element.GetAttributeValue<long>("uts");
                }

                Images = doc.Root.ExtracktItems<LfmImage>("image");
            }
        }