Exemple #1
0
        internal static Page Load(XElement p)
        {
            Page ret = new Page();

            ret.ID = p.Attribute("id").Value;
            ret.Body = new TMLDoc(p.Element(XName.Get("body", Adventure.NS)));

            return ret;
        }
Exemple #2
0
        private void Load(XElement doc)
        {
            foreach (var p in doc.Element(XName.Get("pages", NS)).Elements(XName.Get("page", NS))) {
                Page page = Page.Load(p);

                if (Pages.ContainsKey(page.ID)) throw new ApplicationException("Duplicate page ID " + page.ID);

                Pages[page.ID] = page;
            }
            var start = doc.Element(XName.Get("start", NS));

            if (start == null) throw new ApplicationException("start page is missing");

            var startp = start.Value;
            if (!Pages.ContainsKey(startp)) throw new ApplicationException("start page is undefined");

            Start = Pages[startp];
        }