public object Unpack(Packer packer) { var typeId = Int32Serializer.UnpackDirect(packer); var rootType = packer.GetMetaType(typeId); return(this.Unpack(packer, rootType)); }
public static byte[] UnpackDirect(Packer packer) { var length = Int32Serializer.UnpackDirect(packer); var arr = new byte[length]; packer.ReadBytes(arr); return(arr); }
public static Packer.MetaType UnpackDirect(Packer packer) { var meta = new Packer.MetaType(); meta.id = Int32Serializer.UnpackDirect(packer); meta.type = StringSerializer.UnpackDirect(packer); return(meta); }
public object Unpack(Packer stream) { var v = new Vector2Int(); v.x = Int32Serializer.UnpackDirect(stream); v.y = Int32Serializer.UnpackDirect(stream); return(v); }
public object Unpack(Packer packer) { var length = Int32Serializer.UnpackDirect(packer); var meta = new Packer.MetaType[length]; for (int i = 0; i < length; ++i) { meta[i] = packer.UnpackInternal <Packer.MetaType>(); } return(meta); }
public static Packer.MetaType[] UnpackDirect(Packer packer) { var length = Int32Serializer.UnpackDirect(packer); var meta = new Packer.MetaType[length]; for (int i = 0; i < length; ++i) { meta[i] = MetaTypeSerializer.UnpackDirect(packer); } return(meta); }
public object Unpack(Packer packer) { var length = Int32Serializer.UnpackDirect(packer); var arr = new object[length]; for (int i = 0; i < length; ++i) { arr[i] = packer.UnpackInternal(); } return(arr); }
public static string UnpackDirect(Packer packer) { var length = Int32Serializer.UnpackDirect(packer); var sb = new System.Text.StringBuilder(length); sb.Clear(); sb.Capacity = length; for (int i = 0; i < length; ++i) { sb.Append(CharSerializer.UnpackDirect(packer)); } var res = sb.ToString(); return(res); }
public static string UnpackDirect(Packer packer) { var length = Int32Serializer.UnpackDirect(packer); var sb = PoolClass <System.Text.StringBuilder> .Spawn(); sb.Clear(); sb.Capacity = length; for (int i = 0; i < length; ++i) { sb.Append(CharSerializer.UnpackDirect(packer)); } var res = sb.ToString(); PoolClass <System.Text.StringBuilder> .Recycle(ref sb); return(res); }
public object Unpack(Packer packer) { var type = packer.GetMetaType(Int32Serializer.UnpackDirect(packer)); var typeValue = packer.GetMetaType(Int32Serializer.UnpackDirect(packer)); var typeProvider = packer.GetMetaType(Int32Serializer.UnpackDirect(packer)); var sentinelType = type.MakeGenericType(typeValue, typeProvider); var poolClassType = typeof(PoolClass <>).MakeGenericType(sentinelType); var spawnMethod = poolClassType.GetMethod("Spawn", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static); var sentinel = (IDisposeSentinel)spawnMethod.Invoke(null, null); sentinel.SetData(packer.UnpackInternal()); sentinel.SetTick(Int64Serializer.UnpackDirect(packer)); return(sentinel); }
public object Unpack(Packer packer) { var length = Int32Serializer.UnpackDirect(packer); var typeIdValue = Int32Serializer.UnpackDirect(packer); var typeValue = packer.GetMetaType(typeIdValue); var type = packer.GetMetaType(Int32Serializer.UnpackDirect(packer)); var t = type.MakeGenericType(typeValue); var dict = (ME.ECS.Collections.IDictionaryInt)System.Activator.CreateInstance(t); for (int i = 0; i < length; ++i) { dict.Add(packer.UnpackInternal(), packer.UnpackInternal()); } return(dict); }
public object Unpack(Packer packer) { var pack = new ME.ECS.StatesHistory.HistoryEvent(); pack.tick = Int64Serializer.UnpackDirect(packer); pack.order = Int32Serializer.UnpackDirect(packer); pack.rpcId = Int32Serializer.UnpackDirect(packer); pack.localOrder = Int32Serializer.UnpackDirect(packer); pack.objId = Int32Serializer.UnpackDirect(packer); pack.groupId = Int32Serializer.UnpackDirect(packer); pack.storeInHistory = BooleanSerializer.UnpackDirect(packer); var hasParams = packer.ReadByte(); if (hasParams == 1) { var serializer = new ObjectArraySerializer(); pack.parameters = (object[])serializer.Unpack(packer); } return(pack); }
public object Unpack(Packer packer) { var length = Int32Serializer.UnpackDirect(packer); var isArray = packer.ReadByte(); var typeId = Int32Serializer.UnpackDirect(packer); var typeIn = packer.GetMetaType(typeId); IList arr = null; if (isArray == 2) { var rank = Int32Serializer.UnpackDirect(packer); if (rank > 1) { var lengthArray = new int[rank]; for (int j = 0; j < rank; ++j) { lengthArray[j] = Int32Serializer.UnpackDirect(packer); } var arrData = System.Array.CreateInstance(typeIn, lengthArray); arr = arrData; void WrapDimension(int[] ids, int currentDimension) { if (currentDimension == rank) { arrData.SetValue(packer.UnpackInternal(), ids); } else { for (int i = 0, len = arrData.GetLength(currentDimension); i < len; i++) { ids[currentDimension] = i; WrapDimension(ids, currentDimension + 1); } } } WrapDimension(new int[rank], 0); } } else if (isArray == 1) { arr = System.Array.CreateInstance(typeIn, length); for (int i = 0; i < length; ++i) { arr[i] = packer.UnpackInternal(); } } else { var type = packer.GetMetaType(Int32Serializer.UnpackDirect(packer)); var t = type.MakeGenericType(typeIn); arr = (IList)System.Activator.CreateInstance(t); for (int i = 0; i < length; ++i) { arr.Add(packer.UnpackInternal()); } } return(arr); }
public object Unpack(Packer packer) { return((RPCId)Int32Serializer.UnpackDirect(packer)); }