Example #1
0
File: Main.cs Project: jbowwww/JGL
 public static void DeserializeScene()
 {
     Scene scene;
     XmlSerializer xs = new XmlSerializer();
     using (Stream s = File.Open ("/home/jk/Code/JGL/Data/XML/out_scene.xml", FileMode.Open))
     {
         scene = xs.Deserialize (s) as Scene;
     }
 }
Example #2
0
 public static void TestXmlSerializing()
 {
     var answer = new Answer<string>("Ответ.", true);
     var xs = new XmlSerializer<Answer<string>>();
     using (var fileStream = File.Create(Path.Combine("save", "answer.xml")))
     {
         xs.Serialize(fileStream, answer);
     }
     using (var fileStream = File.OpenRead(Path.Combine("save", "answer.xml")))
     {
         var deserializedAnswer = xs.Deserialize(fileStream);
         Debug.Assert(deserializedAnswer.Contents == answer.Contents);
     }
 }