Beispiel #1
0
        public static void wrapFileSerial(string filename)
        {
            // Create desert name
            var rce = new RCE();
            // Persist to file
            TextWriter    writer     = new StreamWriter(filename + ".xml");
            XmlSerializer serializer = new XmlSerializer(typeof(Object));

            Console.WriteLine("Serializing desert");
            serializer.Serialize(writer, rce);
            writer.Close();
        }
Beispiel #2
0
        public static void desertSerial(string filename)
        {
            // Create desert name
            //var desert = new Desert();
            //desert.name = "Gobi";
            var desert = new RCE();
            // Persist to file
            FileStream stream    = File.Create(filename);
            var        formatter = new BinaryFormatter();

            Console.WriteLine("Serializing desert");
            formatter.Serialize(stream, desert);
            stream.Close();
        }
Beispiel #3
0
        public static void jsonRCESerial(string filename)
        {
            filename += ".json";
            var desert = new RCE();

            desert.cmd = "calc.exe";
            // Persist to file
            using (StreamWriter stream = File.CreateText(filename))
            {
                Console.WriteLine("Serializing RCE");
                JavaScriptSerializer serializer = new JavaScriptSerializer(new SimpleTypeResolver());
                stream.Write(serializer.Serialize(desert));
            }
        }