コード例 #1
0
ファイル: Program.cs プロジェクト: narcine/Pictures
 public static void Serialize(Album details)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(Album));
     using (TextWriter writer = new StreamWriter(@details.fname))
     {
         serializer.Serialize(writer, details);
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: narcine/Pictures
        static void Main(string[] args)
        {
            Album test = new Album();
            Picture n = new Picture();

            // Album.load_Albums();

            n.tags.Add("Prout !");
            n.fname = "./Images/Desert.jpg";
            test.content.Add(n);
            test.name = "TOTO";
            test.place = "Venise";
            //test.fname = "./Albums/merde.xml";
            Album.Serialize(test);
            Console.WriteLine("Seriaization done !");
            Console.WriteLine(test.name + " " + test.fname);
            Album test2 =
            Album.Deserializer(test.fname);

            // Console.WriteLine(test2.ToString2());
            Console.WriteLine("Read :" + test2.name + " " + test2.fname);
            Console.ReadKey();

            test.place = "paris";

            Album.Serialize(test);
            Console.WriteLine("Seriaization done !");
            Console.WriteLine(test.name + " " + test.fname + " " + test.place);
            Album test3 = Album.Deserializer(test.fname);

            // Console.WriteLine(test2.ToString2());
            Console.WriteLine("Read :" + test3.name + " " + test3.fname + " " + test3.place);
            // */

            Console.ReadKey();
        }