Beispiel #1
0
        public void TestBasicWriteRead()
        {
            FileSerializer <SerializationTestBasic> serializer = new FileSerializer <SerializationTestBasic>();

            SerializationTestBasic write = new SerializationTestBasic {
                TestBool       = true,
                TestInt        = -100,
                TestString     = "abc" + Environment.NewLine + "def",
                TestStringNull = null,
                TestEnum       = TestEnum.D
            };

            serializer.Write("basic_wr", write);
            Assert.IsTrue(File.Exists("basic_wr"));

            SerializationTestBasic read = new SerializationTestBasic();

            serializer.Read("basic_wr", read);

            Assert.IsTrue(read.TestBool);
            Assert.AreEqual(-100, read.TestInt);
            Assert.AreEqual("abc" + Environment.NewLine + "def", read.TestString);
            Assert.IsNull(read.TestStringNull);
            Assert.AreEqual(TestEnum.D, read.TestEnum);
        }
Beispiel #2
0
 public void Save()
 {
     try{
         Serializer.Write(file, this);
     }catch (Exception e) {
         Program.Reporter.HandleException("Analytics File Error", "Could not save the analytics file.", true, e);
     }
 }
Beispiel #3
0
        //override protected IWriter _GetSequenceWriter() {
        //    return new XmlScriptSequenceWriter();
        //}

        //public override int Version {
        //    get { return VERSION; }
        //}
        public override void Save(string filePath)
        {
            FileSerializer <ScriptSequence> serializer = SerializerFactory.Instance.CreateScriptSequenceSerializer();

            serializer.Write(this, filePath);
        }
Beispiel #4
0
        virtual public void Save(string filePath)
        {
            FileSerializer <Sequence> serializer = SerializerFactory.Instance.CreateStandardSequenceSerializer();

            serializer.Write(this, filePath);
        }