private unsafe static void deSerialize(fastCSharp.emit.dataDeSerializer deSerializer, ref fileBlockMember <valueType> value) { if (deSerializer.CheckNull() == 0) { value.index.Null(); value.value = default(valueType); } else { byte *read = deSerializer.Read; int indexCustom = *(int *)read; if ((indexCustom & 0x7fffff00) == (emit.pub.PuzzleValue & 0x7fffff00)) { if ((indexCustom & (int)custom.Serialize) == 0) { if (value.index.ReSet(*(long *)(read + sizeof(int) * 2), *(int *)(read + sizeof(int))) == 0) { value.index.Custom = 0; value.value = default(valueType); } deSerializer.Read += sizeof(int) * 2 + sizeof(long); } else { deSerializer.Read += sizeof(int); fastCSharp.emit.dataDeSerializer.typeDeSerializer <valueType> .DeSerialize(deSerializer, ref value.value); } } else { deSerializer.Error(emit.binaryDeSerializer.deSerializeState.UnknownData); } } }
private unsafe static void serialize(fastCSharp.emit.dataSerializer serializer, fileBlockMember <valueType> value) { int indexCustom = value.index.Custom; if ((indexCustom & (int)custom.Serialize) == 0) { if (value.index.Size == 0) { serializer.Stream.Write(fastCSharp.emit.binarySerializer.NullValue); } else { unmanagedStream stream = serializer.Stream; stream.PrepLength(sizeof(int) * 2 + sizeof(long)); byte *data = stream.CurrentData; *(int *)data = (emit.pub.PuzzleValue & 0x7fffff00) + indexCustom; *(int *)(data + sizeof(int)) = value.index.Size; *(long *)(data + sizeof(int) * 2) = value.index.Index; stream.UnsafeAddLength(sizeof(int) * 2 + sizeof(long)); stream.PrepLength(); } } else if (value.value == null) { serializer.Stream.Write(fastCSharp.emit.binarySerializer.NullValue); } else { serializer.Stream.Write(indexCustom); fastCSharp.emit.dataSerializer.typeSerializer <valueType> .Serialize(serializer, value.value); } }