예제 #1
0
        private Page ParsePage(Sitemap aSitemap, XElement aRoot)
        {
            var page = new Page(this);

            var id = aRoot.Element("id").Value;
            var title = aRoot.Element("title").Value;
            var link = aRoot.Element("link").Value;

            page.Id = id;
            page.Title = title;
            page.Link = new Uri(link);

            foreach (var widget in aRoot.Elements("widget"))
            {
                page.mWidgets.Add(ParseWidget(aSitemap, widget));
            }

            aSitemap.mPages[id] = page;
            Pages[id] = page;

            return page;
        }
예제 #2
0
        internal Sitemap(REST aRest, System.IO.BinaryReader aReader)
        {
            Name = aReader.ReadString();
            Link = new Uri(aReader.ReadString());
            Homepage = new Uri(aReader.ReadString());

            var count = aReader.ReadInt32();
            for (var idx = 0; idx < count; ++idx)
            {
                Item item;
                if (aRest.Items.TryGetValue(aReader.ReadString(), out item))
                    Items[item.Name] = item;
            }

            Page page;
            count = aReader.ReadInt32();
            for (var idx = 0; idx < count; ++idx)
            {
                if (aRest.Pages.TryGetValue(aReader.ReadString(), out page))
                    Pages[page.Id] = page;
            }

            if (aRest.Pages.TryGetValue(aReader.ReadString(), out page))
                Page = page;
        }