Example #1
0
 public static void LoadClientPetFeed(string rootPath)
 {
     try {
         using (var fs = new FileStream(Path.Combine(rootPath, @".\data\toypet_feed.xml"),
                                        FileMode.Open, FileAccess.Read))
             using (var reader = XmlReader.Create(fs)) {
                 XmlSerializer ser = new XmlSerializer(typeof(ClientToypetFeed));
                 PetFeed = (ClientToypetFeed)ser.Deserialize(reader);
             }
     } catch (Exception ex) {
         Debug.Print(ex.ToString());
     }
 }
Example #2
0
 public static void LoadClientPetFeed(string rootPath)
 {
     try {
         using (var fs = new FileStream(Path.Combine(rootPath, @".\data\toypet_feed.xml"),
                                        FileMode.Open, FileAccess.Read))
         using (var reader = XmlReader.Create(fs)) {
             XmlSerializer ser = new XmlSerializer(typeof(ClientToypetFeed));
             PetFeed = (ClientToypetFeed)ser.Deserialize(reader);
         }
     } catch (Exception ex) {
         Debug.Print(ex.ToString());
     }
 }
Example #3
0
 public static void LoadClientPetFeed(string rootPath)
 {
     try {
         using (var fs = new FileStream(Path.Combine(rootPath, @".\data\pets\toypet_feed.xml"),
                                        FileMode.Open, FileAccess.Read))
         using (var reader = XmlReader.Create(fs)) {
             XmlSerializer ser = new XmlSerializer(typeof(ClientToypetFeed));
             ser.UnknownElement += new XmlElementEventHandler(delegate(object sender, XmlElementEventArgs e)
             {
                 Debug.Print("Unknown element: '{0}' (line: {1})", e.Element.Name, e.LineNumber);
             });
             PetFeed = (ClientToypetFeed)ser.Deserialize(reader);
         }
     }
     catch (Exception ex) {
         Debug.Print(ex.ToString());
     }
     Console.WriteLine("loaded {0:d6} client_toypet_feeds.", PetFeed.Items.Count());
 }