public object Unpack(Packer stream) { object res = null; var enumType = (TypeValue)stream.ReadByte(); if (enumType == TypeValue.Int32) { var ser = new Int32Serializer(); res = ser.Unpack(stream); } else if (enumType == TypeValue.Int16) { var ser = new Int16Serializer(); res = ser.Unpack(stream); } else if (enumType == TypeValue.Int64) { var ser = new Int64Serializer(); res = ser.Unpack(stream); } else if (enumType == TypeValue.UInt16) { var ser = new UInt16Serializer(); res = ser.Unpack(stream); } else if (enumType == TypeValue.UInt32) { var ser = new UInt32Serializer(); res = ser.Unpack(stream); } else if (enumType == TypeValue.UInt64) { var ser = new UInt64Serializer(); res = ser.Unpack(stream); } else if (enumType == TypeValue.Byte) { var ser = new ByteSerializer(); res = ser.Unpack(stream); } else if (enumType == TypeValue.SByte) { var ser = new SByteSerializer(); res = ser.Unpack(stream); } else { var ser = new StringSerializer(); var str = (string)ser.Unpack(stream); res = System.Enum.Parse(typeof(System.Enum), str); } return(res); }
public object Unpack(Packer packer) { var int64 = new Int64Serializer(); return((Tick)(System.Int64)(int64.Unpack(packer))); }