void TestB(CompiledPacker packer) { TestB_Class obj0 = TestB_Class.Create(); TestB_Class obj1 = packer.Unpack <TestB_Class> (packer.Pack <TestB_Class> (obj0)); obj0.Check(obj1); }
void TestA(CompiledPacker packer) { TestA_Class obj0 = new TestA_Class(); TestA_Class obj1 = packer.Unpack <TestA_Class> (packer.Pack <TestA_Class> (obj0)); obj0.Check(obj1); }
public override object ReadFromStream(Type type, System.IO.Stream readStream, System.Net.Http.HttpContent content, IFormatterLogger formatterLogger) { if (content.Headers != null && content.Headers.ContentLength == 0) return null; object result; try { var packer = new CompiledPacker(packPrivateField: false); result = packer.Unpack(type, readStream); } catch (Exception ex) { if (formatterLogger == null) throw; formatterLogger.LogError("", ex.Message); result = GetDefaultValueForType(type); } return result; }
/// <summary> /// bytes反序列化成对像 /// </summary> /// <typeparam name="T">对像类型</typeparam> /// <param name="data">bytes</param> /// <returns>对像</returns> public T Deserialize <T>(byte[] data) { return(packer.Unpack <T>(data)); }
public static T MsgPackFromBytes <T>(byte[] bytes) { return(packer.Unpack <T>(bytes)); }
void TestB(CompiledPacker packer) { TestB_Class obj0 = TestB_Class.Create (); TestB_Class obj1 = packer.Unpack<TestB_Class> (packer.Pack<TestB_Class> (obj0)); obj0.Check (obj1); }
void TestA(CompiledPacker packer) { TestA_Class obj0 = new TestA_Class (); TestA_Class obj1 = packer.Unpack<TestA_Class> (packer.Pack<TestA_Class> (obj0)); obj0.Check (obj1); }