public static void Main(string[] args) { MsgPackSerializer.DefaultContext.SerializationMethod = SerializationMethod.Map; testMsg = AnimalMessage.CreateTestMessage(); // Warm-up for both //TestCli(); //TestMsgPackSharp(); // Actual tests... TimeTest(TestMsgPackSharp, "Serialize and Deserialize with MsgPack-Sharp"); }
public static void Main(string[] args) { testMsg = AnimalMessage.CreateTestMessage(); // Warm-up for both //TestCli(); //TestMsgPackSharp(); // Actual tests... TimeTest(TestCli, "Serialize and Deserialize with Official CLI"); TimeTest(TestMsgPackSharp, "Serialize and Deserialize with MsgPack-Sharp"); }
public static int Main(string[] args) { int result = 1; if (args[0] == "capturecli") { AnimalMessage msg = AnimalMessage.CreateTestMessage(); var serializer = MessagePackSerializer.Create <AnimalMessage>(); using (MemoryStream outStream = new MemoryStream()) { serializer.Pack(outStream, msg); byte[] output = outStream.ToArray(); File.WriteAllBytes("cli.msg", output); } } else { try { byte[] payload = File.ReadAllBytes(args[0]); Console.Out.WriteLine("read " + payload.Length + " bytes"); var serializer = MessagePackSerializer.Create <AnimalMessage>(); using (MemoryStream stream = new MemoryStream(payload)) { var restored = serializer.Unpack(stream); using (MemoryStream outStream = new MemoryStream()) { serializer.Pack(outStream, restored); byte[] output = outStream.ToArray(); File.WriteAllBytes(args[0] + ".out", output); } result = 0; } } catch (Exception ex) { Console.Out.WriteLine("Error: " + ex); } } return(result); }
public static void Main(string[] args) { testMsg = AnimalMessage.CreateTestMessage(); TimeTest(TestCli, "Serialize and Deserialize with Official CLI"); }