コード例 #1
0
        public static void LoadQuestFile(string rootPath)
        {
            var readSettings = new XmlReaderSettings()
            {
                ProhibitDtd     = false,
                CheckCharacters = false,
                CloseInput      = false
            };

            try {
                using (var fs = new FileStream(Path.Combine(rootPath, @".\data\quest.xml"),
                                               FileMode.Open, FileAccess.Read))
                    using (var reader = XmlReader.Create(fs, readSettings)) {
                        XmlSerializer ser = new XmlSerializer(typeof(QuestsFile));
                        ser.UnknownElement += new XmlElementEventHandler(delegate(object sender, XmlElementEventArgs e)
                        {
                            Debug.Print("Unknown element: '{0}' (line: {1})", e.Element.Name, e.LineNumber);
                        });
                        QuestIndex = (QuestsFile)ser.Deserialize(reader);
                    }
            } catch (Exception ex) {
                Debug.Print(ex.ToString());
            }
        }
コード例 #2
0
ファイル: Utility.cs プロジェクト: CeeJay79/aion_ext
 public static void LoadQuestFile(string rootPath)
 {
     var readSettings = new XmlReaderSettings()
     {
         ProhibitDtd = false,
         CheckCharacters = false,
         CloseInput = false
     };
     try {
         using (var fs = new FileStream(Path.Combine(rootPath, @".\data\quest.xml"),
                                        FileMode.Open, FileAccess.Read))
         using (var reader = XmlReader.Create(fs, readSettings)) {
             XmlSerializer ser = new XmlSerializer(typeof(QuestsFile));
             ser.UnknownElement += new XmlElementEventHandler(delegate(object sender, XmlElementEventArgs e)
             {
                 Debug.Print("Unknown element: '{0}' (line: {1})", e.Element.Name, e.LineNumber);
             });
             QuestIndex = (QuestsFile)ser.Deserialize(reader);
         }
     } catch (Exception ex) {
         Debug.Print(ex.ToString());
     }
 }