static void Main(string [] args) { var p = new BinarySerializationOverVersions(); /* this block is useful for testing this without NUnit: * if (args.Length == 0) * { * Console.WriteLine ("Starting..."); * p.TestDroppedField (); * Console.Write ("x"); * p.TestAddedField (); * Console.Write ("x"); * * p.TestAddedFieldWithData (); * Console.Write ("x"); * p.TestDroppedFieldWithData (); * Console.Write ("x"); * * p.TestAddedFieldWithOptionalAttrib (); * Console.Write ("x"); * p.TestDroppedFieldWithOptionalAttrib (); * Console.Write ("x"); * * p.TestAddedFieldWithOptionalAttribAndData (); * Console.Write ("x"); * p.TestDroppedFieldWithOptionalAttribAndData (); * Console.Write ("x"); * * Console.WriteLine (); * Environment.Exit (0); * }*/ if (args.Length < 2) { throw new Exception("Please specify arguments"); } if (args [0] == OopOperation.Serialize.ToString()) { p.SerializeToFile(args [1]); } else if (args [0] == OopOperation.Deserialize.ToString()) { p.DeserializeFromFile(args [1]); } else { throw new Exception(String.Format("{0} operation not recognized. Only {Serialize|Deserialize} operations are supported.", args [0])); } }
static void Main (string [] args) { var p = new BinarySerializationOverVersions (); /* this block is useful for testing this without NUnit: if (args.Length == 0) { Console.WriteLine ("Starting..."); p.TestDroppedField (); Console.Write ("x"); p.TestAddedField (); Console.Write ("x"); p.TestAddedFieldWithData (); Console.Write ("x"); p.TestDroppedFieldWithData (); Console.Write ("x"); p.TestAddedFieldWithOptionalAttrib (); Console.Write ("x"); p.TestDroppedFieldWithOptionalAttrib (); Console.Write ("x"); p.TestAddedFieldWithOptionalAttribAndData (); Console.Write ("x"); p.TestDroppedFieldWithOptionalAttribAndData (); Console.Write ("x"); Console.WriteLine (); Environment.Exit (0); }*/ if (args.Length < 2) throw new Exception ("Please specify arguments"); if (args [0] == OopOperation.Serialize.ToString ()) { p.SerializeToFile (args [1]); } else if (args [0] == OopOperation.Deserialize.ToString ()) { p.DeserializeFromFile (args [1]); } else { throw new Exception(String.Format ("{0} operation not recognized. Only {Serialize|Deserialize} operations are supported.", args [0])); } }