예제 #1
0
파일: Page.cs 프로젝트: pkmnfrk/cyoa
        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;
        }
예제 #2
0
파일: Adventure.cs 프로젝트: pkmnfrk/cyoa
        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];
        }