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