/// <summary> /// 数据成员解析 /// </summary> /// <param name="jsonDeSerializer">Json解析器</param> /// <param name="value">目标数据</param> internal static void DeSerializeMembers(JsonDeSerializer jsonDeSerializer, ref T value) { #if NOJIT byte *names = memberNames.Byte; #endif DeSerializeConfig config = jsonDeSerializer.Config; MemberMap memberMap = jsonDeSerializer.MemberMap; if (memberMap == null) { #if NOJIT int index = 0; while ((names = jsonDeSerializer.IsName(names, ref index)) != null) { if (index == -1) { return; } memberDeSerializers[index].TryDeSerialize(jsonDeSerializer, ref value); if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success) { return; } ++index; } #else int index = deSerializeMember(jsonDeSerializer, ref value, memberNames.Byte); if (index == -1) { return; } #endif if (index == 0 ? jsonDeSerializer.IsFirstObject() : jsonDeSerializer.IsNextObject()) { bool isQuote; if (onUnknownName == null) { do { if ((index = memberSearcher.SearchName(jsonDeSerializer, out isQuote)) != -1) { if (jsonDeSerializer.SearchColon() == 0) { return; } memberDeSerializers[index].TryDeSerialize(jsonDeSerializer, ref value); } else { if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success) { return; } if (isQuote) { jsonDeSerializer.SearchStringEnd(); } else { jsonDeSerializer.SearchNameEnd(); } if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success || jsonDeSerializer.SearchColon() == 0) { return; } jsonDeSerializer.Ignore(); } }while (jsonDeSerializer.DeSerializeState == DeSerializeState.Success && jsonDeSerializer.IsNextObject()); } else { AutoCSer.Memory.Pointer name; #if !Serialize name.CurrentIndex = 0; #endif do { name.Data = jsonDeSerializer.Current; if ((index = memberSearcher.SearchName(jsonDeSerializer, out isQuote)) != -1) { if (jsonDeSerializer.SearchColon() == 0) { return; } memberDeSerializers[index].TryDeSerialize(jsonDeSerializer, ref value); } else { if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success) { return; } if (isQuote) { jsonDeSerializer.SearchStringEnd(); } else { jsonDeSerializer.SearchNameEnd(); } if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success) { return; } name.ByteSize = (int)((byte *)jsonDeSerializer.Current - (byte *)name.Data); if (jsonDeSerializer.SearchColon() == 0) { return; } if (isQuote) { name.Data = name.Byte + 2; name.ByteSize -= 4; } onUnknownName(jsonDeSerializer, ref value, ref name); if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success) { return; } } }while (jsonDeSerializer.IsNextObject()); } } } else if (object.ReferenceEquals(memberMap.Type, MemberMap <T> .MemberMapType)) { try { memberMap.Empty(); jsonDeSerializer.MemberMap = null; #if NOJIT int index = 0; while ((names = jsonDeSerializer.IsName(names, ref index)) != null) { if (index == -1) { return; } memberDeSerializers[index].Call(jsonDeSerializer, memberMap, ref value); if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success) { return; } ++index; } #else int index = deSerializeMemberMap(jsonDeSerializer, ref value, memberNames.Byte, memberMap); if (index == -1) { return; } #endif if (index == 0 ? jsonDeSerializer.IsFirstObject() : jsonDeSerializer.IsNextObject()) { bool isQuote; if (onUnknownName == null) { do { if ((index = memberSearcher.SearchName(jsonDeSerializer, out isQuote)) != -1) { if (jsonDeSerializer.SearchColon() == 0) { return; } memberDeSerializers[index].Call(jsonDeSerializer, memberMap, ref value); } else { if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success) { return; } if (isQuote) { jsonDeSerializer.SearchStringEnd(); } else { jsonDeSerializer.SearchNameEnd(); } if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success || jsonDeSerializer.SearchColon() == 0) { return; } jsonDeSerializer.Ignore(); } }while (jsonDeSerializer.DeSerializeState == DeSerializeState.Success && jsonDeSerializer.IsNextObject()); } else { AutoCSer.Memory.Pointer name; #if !Serialize name.CurrentIndex = 0; #endif do { name.Data = jsonDeSerializer.Current; if ((index = memberSearcher.SearchName(jsonDeSerializer, out isQuote)) != -1) { if (jsonDeSerializer.SearchColon() == 0) { return; } memberDeSerializers[index].Call(jsonDeSerializer, memberMap, ref value); } else { if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success) { return; } if (isQuote) { jsonDeSerializer.SearchStringEnd(); } else { jsonDeSerializer.SearchNameEnd(); } if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success) { return; } name.ByteSize = (int)((byte *)jsonDeSerializer.Current - (byte *)name.Data); if (jsonDeSerializer.SearchColon() == 0) { return; } if (isQuote) { name.Data = name.Byte + 2; name.ByteSize -= 4; } onUnknownName(jsonDeSerializer, ref value, ref name); if (jsonDeSerializer.DeSerializeState != DeSerializeState.Success) { return; } } }while (jsonDeSerializer.IsNextObject()); } } } finally { jsonDeSerializer.MemberMap = memberMap; } } else { jsonDeSerializer.DeSerializeState = DeSerializeState.MemberMap; } }