private GetMemberInfo ( string &outMemberNames, |
||
outMemberNames | string | |
outMemberTypes | ||
outMemberData | object | |
Résultat | void |
private void Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) { object obj = objectInfo.obj; if (obj == null) { throw new ArgumentNullException("objectInfo.obj", Environment.GetResourceString("ArgumentNull_Obj")); } Type type1 = objectInfo.objectType; long num = objectInfo.objectId; Type type2 = Converter.typeofString; if (type1 == type2) { memberNameInfo.NIobjectId = num; this.serWriter.WriteObjectString((int)num, obj.ToString()); } else if (objectInfo.isArray) { this.WriteArray(objectInfo, memberNameInfo, (WriteObjectInfo)null); } else { string[] outMemberNames; Type[] outMemberTypes; object[] outMemberData; objectInfo.GetMemberInfo(out outMemberNames, out outMemberTypes, out outMemberData); if (objectInfo.isSi || this.CheckTypeFormat(this.formatterEnums.FEtypeFormat, FormatterTypeStyle.TypesAlways)) { memberNameInfo.NItransmitTypeOnObject = true; memberNameInfo.NIisParentTypeOnObject = true; typeNameInfo.NItransmitTypeOnObject = true; typeNameInfo.NIisParentTypeOnObject = true; } WriteObjectInfo[] memberObjectInfos = new WriteObjectInfo[outMemberNames.Length]; for (int index = 0; index < outMemberTypes.Length; ++index) { Type type3 = outMemberTypes[index] == null ? (outMemberData[index] == null ? Converter.typeofObject : this.GetType(outMemberData[index])) : outMemberTypes[index]; if (this.ToCode(type3) == InternalPrimitiveTypeE.Invalid && type3 != Converter.typeofString) { if (outMemberData[index] != null) { memberObjectInfos[index] = WriteObjectInfo.Serialize(outMemberData[index], this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this, this.m_binder); memberObjectInfos[index].assemId = this.GetAssemblyId(memberObjectInfos[index]); } else { memberObjectInfos[index] = WriteObjectInfo.Serialize(outMemberTypes[index], this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this.m_binder); memberObjectInfos[index].assemId = this.GetAssemblyId(memberObjectInfos[index]); } } } this.Write(objectInfo, memberNameInfo, typeNameInfo, outMemberNames, outMemberTypes, outMemberData, memberObjectInfos); } }
[System.Security.SecurityCritical] // auto-generated private void Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) { #if _DEBUG SerTrace.Log( this, "Write 1 Entry objectInfo ",objectInfo,", memberNameInfo ",memberNameInfo,", typeNameInfo ",typeNameInfo); memberNameInfo.Dump("Write memberNameInfo"); typeNameInfo.Dump("Write typeNameInfo"); #endif Object obj = objectInfo.obj; if (obj==null) throw new ArgumentNullException("objectInfo.obj", Environment.GetResourceString("ArgumentNull_Obj")); SerTrace.Log( this, "Write 1 objectInfo obj ",objectInfo.obj," objectId ", objectInfo.objectId, " objectType ", objectInfo.objectType); Type objType = objectInfo.objectType; long objectId = objectInfo.objectId; SerTrace.Log( this, "Write 1 ",obj," ObjectId ",objectId); if (Object.ReferenceEquals(objType, Converter.typeofString)) { // Top level String memberNameInfo.NIobjectId = objectId; serWriter.WriteObjectString((int)objectId, obj.ToString()); } else { if (objectInfo.isArray) { WriteArray(objectInfo, memberNameInfo, null); } else { String[] memberNames; Type[] memberTypes; Object[] memberData; objectInfo.GetMemberInfo(out memberNames, out memberTypes, out memberData); // Only Binary needs to transmit types for ISerializable because the binary formatter transmits the types in URT format. // Soap transmits all types as strings, so it is up to the ISerializable object to convert the string back to its URT type if (objectInfo.isSi || CheckTypeFormat(formatterEnums.FEtypeFormat, FormatterTypeStyle.TypesAlways)) { SerTrace.Log( this, "Write 1 TransmitOnObject "); memberNameInfo.NItransmitTypeOnObject = true; memberNameInfo.NIisParentTypeOnObject = true; typeNameInfo.NItransmitTypeOnObject = true; typeNameInfo.NIisParentTypeOnObject = true; } WriteObjectInfo[] memberObjectInfos = new WriteObjectInfo[memberNames.Length]; // Get assembly information // Binary Serializer, assembly names need to be // written before objects are referenced. // GetAssemId here will write out the // assemblyStrings at the right Binary // Serialization object boundary. for (int i=0; i<memberTypes.Length; i++) { Type type; if ((object)memberTypes[i] != null) type = memberTypes[i]; else if (memberData[i] != null) type = GetType(memberData[i]); else type = Converter.typeofObject; SerTrace.Log( this, "Write 1 member type ",type); InternalPrimitiveTypeE code = ToCode(type); if ((code == InternalPrimitiveTypeE.Invalid) && (!Object.ReferenceEquals(type, Converter.typeofString))) { SerTrace.Log( this, "Write 1 Create ObjectInfo ", memberTypes[i], " memberData ",memberData[i]); if (memberData[i] != null) { memberObjectInfos[i] = WriteObjectInfo.Serialize ( memberData[i], m_surrogates, m_context, serObjectInfoInit, m_formatterConverter, this, m_binder); memberObjectInfos[i].assemId = GetAssemblyId(memberObjectInfos[i]); } else { memberObjectInfos[i] = WriteObjectInfo.Serialize ( memberTypes[i], m_surrogates, m_context, serObjectInfoInit, m_formatterConverter, m_binder ); memberObjectInfos[i].assemId = GetAssemblyId(memberObjectInfos[i]); } } } Write(objectInfo, memberNameInfo, typeNameInfo, memberNames, memberTypes, memberData, memberObjectInfos); SerTrace.Log( this, "Write 1 ",obj," type ",GetType(obj)); } } SerTrace.Log( this, "Write 1 Exit ",obj); }
// Writes a given object to the stream. private void Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) { object obj = objectInfo._obj; if (obj == null) { throw new ArgumentNullException(nameof(objectInfo) + "." + nameof(objectInfo._obj)); } Type objType = objectInfo._objectType; long objectId = objectInfo._objectId; if (ReferenceEquals(objType, Converter.s_typeofString)) { // Top level String memberNameInfo._objectId = objectId; _serWriter.WriteObjectString((int)objectId, obj.ToString()); } else { if (objectInfo._isArray) { WriteArray(objectInfo, memberNameInfo, null); } else { string[] memberNames; Type[] memberTypes; object[] memberData; objectInfo.GetMemberInfo(out memberNames, out memberTypes, out memberData); // Only Binary needs to transmit types for ISerializable because the binary formatter transmits the types in URT format. // Soap transmits all types as strings, so it is up to the ISerializable object to convert the string back to its URT type if (objectInfo._isSi || CheckTypeFormat(_formatterEnums._typeFormat, FormatterTypeStyle.TypesAlways)) { memberNameInfo._transmitTypeOnObject = true; memberNameInfo._isParentTypeOnObject = true; typeNameInfo._transmitTypeOnObject = true; typeNameInfo._isParentTypeOnObject = true; } var memberObjectInfos = new WriteObjectInfo[memberNames.Length]; // Get assembly information // Binary Serializer, assembly names need to be // written before objects are referenced. // GetAssemId here will write out the // assemblyStrings at the right Binary // Serialization object boundary. for (int i = 0; i < memberTypes.Length; i++) { Type type = memberTypes[i] != null ? memberTypes[i] : memberData[i] != null?GetType(memberData[i]) : Converter.s_typeofObject; InternalPrimitiveTypeE code = ToCode(type); if ((code == InternalPrimitiveTypeE.Invalid) && (!ReferenceEquals(type, Converter.s_typeofString))) { if (memberData[i] != null) { memberObjectInfos[i] = WriteObjectInfo.Serialize( memberData[i], _surrogates, _context, _serObjectInfoInit, _formatterConverter, this, _binder); memberObjectInfos[i]._assemId = GetAssemblyId(memberObjectInfos[i]); } else { memberObjectInfos[i] = WriteObjectInfo.Serialize( memberTypes[i], _surrogates, _context, _serObjectInfoInit, _formatterConverter, _binder); memberObjectInfos[i]._assemId = GetAssemblyId(memberObjectInfos[i]); } } } Write(objectInfo, memberNameInfo, typeNameInfo, memberNames, memberTypes, memberData, memberObjectInfos); } } }
// Writes a given object to the stream. private void Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) { object obj = objectInfo._obj; if (obj == null) { throw new ArgumentNullException(nameof(objectInfo) + "." + nameof(objectInfo._obj)); } Type objType = objectInfo._objectType; long objectId = objectInfo._objectId; if (ReferenceEquals(objType, Converter.s_typeofString)) { // Top level String memberNameInfo._objectId = objectId; _serWriter.WriteObjectString((int)objectId, obj.ToString()); } else { if (objectInfo._isArray) { WriteArray(objectInfo, memberNameInfo, null); } else { string[] memberNames; Type[] memberTypes; object[] memberData; objectInfo.GetMemberInfo(out memberNames, out memberTypes, out memberData); // Only Binary needs to transmit types for ISerializable because the binary formatter transmits the types in URT format. // Soap transmits all types as strings, so it is up to the ISerializable object to convert the string back to its URT type if (objectInfo._isSi || CheckTypeFormat(_formatterEnums._typeFormat, FormatterTypeStyle.TypesAlways)) { memberNameInfo._transmitTypeOnObject = true; memberNameInfo._isParentTypeOnObject = true; typeNameInfo._transmitTypeOnObject = true; typeNameInfo._isParentTypeOnObject = true; } var memberObjectInfos = new WriteObjectInfo[memberNames.Length]; // Get assembly information // Binary Serializer, assembly names need to be // written before objects are referenced. // GetAssemId here will write out the // assemblyStrings at the right Binary // Serialization object boundary. for (int i = 0; i < memberTypes.Length; i++) { Type type = memberTypes[i] != null ? memberTypes[i] : memberData[i] != null ? GetType(memberData[i]) : Converter.s_typeofObject; InternalPrimitiveTypeE code = ToCode(type); if ((code == InternalPrimitiveTypeE.Invalid) && (!ReferenceEquals(type, Converter.s_typeofString))) { if (memberData[i] != null) { memberObjectInfos[i] = WriteObjectInfo.Serialize( memberData[i], _surrogates, _context, _serObjectInfoInit, _formatterConverter, this, _binder); memberObjectInfos[i]._assemId = GetAssemblyId(memberObjectInfos[i]); } else { memberObjectInfos[i] = WriteObjectInfo.Serialize( memberTypes[i], _surrogates, _context, _serObjectInfoInit, _formatterConverter, _binder); memberObjectInfos[i]._assemId = GetAssemblyId(memberObjectInfos[i]); } } } Write(objectInfo, memberNameInfo, typeNameInfo, memberNames, memberTypes, memberData, memberObjectInfos); } } }
private void Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) { object obj2 = objectInfo.obj; if (obj2 == null) { throw new ArgumentNullException("objectInfo.obj", Environment.GetResourceString("ArgumentNull_Obj")); } Type objectType = objectInfo.objectType; long objectId = objectInfo.objectId; if (object.ReferenceEquals(objectType, Converter.typeofString)) { memberNameInfo.NIobjectId = objectId; this.serWriter.WriteObjectString((int)objectId, obj2.ToString()); } else if (objectInfo.isArray) { this.WriteArray(objectInfo, memberNameInfo, null); } else { string[] strArray; Type[] typeArray; object[] objArray; objectInfo.GetMemberInfo(out strArray, out typeArray, out objArray); if (objectInfo.isSi || this.CheckTypeFormat(this.formatterEnums.FEtypeFormat, FormatterTypeStyle.TypesAlways)) { memberNameInfo.NItransmitTypeOnObject = true; memberNameInfo.NIisParentTypeOnObject = true; typeNameInfo.NItransmitTypeOnObject = true; typeNameInfo.NIisParentTypeOnObject = true; } WriteObjectInfo[] memberObjectInfos = new WriteObjectInfo[strArray.Length]; for (int i = 0; i < typeArray.Length; i++) { Type type; if (typeArray[i] != null) { type = typeArray[i]; } else if (objArray[i] != null) { type = this.GetType(objArray[i]); } else { type = Converter.typeofObject; } if ((this.ToCode(type) == InternalPrimitiveTypeE.Invalid) && !object.ReferenceEquals(type, Converter.typeofString)) { if (objArray[i] != null) { memberObjectInfos[i] = WriteObjectInfo.Serialize(objArray[i], this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this, this.m_binder); memberObjectInfos[i].assemId = this.GetAssemblyId(memberObjectInfos[i]); } else { memberObjectInfos[i] = WriteObjectInfo.Serialize(typeArray[i], this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this.m_binder); memberObjectInfos[i].assemId = this.GetAssemblyId(memberObjectInfos[i]); } } } this.Write(objectInfo, memberNameInfo, typeNameInfo, strArray, typeArray, objArray, memberObjectInfos); } }
private void Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) { object obj = objectInfo.obj; if (obj == null) { throw new ArgumentNullException("objectInfo.obj", Environment.GetResourceString("ArgumentNull_Obj")); } Type objectType = objectInfo.objectType; long objectId = objectInfo.objectId; if (objectType == Converter.typeofString) { memberNameInfo.NIobjectId = objectId; this.serWriter.WriteObjectString((int)objectId, obj.ToString()); return; } if (objectInfo.isArray) { this.WriteArray(objectInfo, memberNameInfo, null); return; } string[] array; Type[] array2; object[] array3; objectInfo.GetMemberInfo(out array, out array2, out array3); if (objectInfo.isSi || this.CheckTypeFormat(this.formatterEnums.FEtypeFormat, FormatterTypeStyle.TypesAlways)) { memberNameInfo.NItransmitTypeOnObject = true; memberNameInfo.NIisParentTypeOnObject = true; typeNameInfo.NItransmitTypeOnObject = true; typeNameInfo.NIisParentTypeOnObject = true; } WriteObjectInfo[] array4 = new WriteObjectInfo[array.Length]; for (int i = 0; i < array2.Length; i++) { Type type; if (array2[i] != null) { type = array2[i]; } else if (array3[i] != null) { type = this.GetType(array3[i]); } else { type = Converter.typeofObject; } if (this.ToCode(type) == InternalPrimitiveTypeE.Invalid && type != Converter.typeofString) { if (array3[i] != null) { array4[i] = WriteObjectInfo.Serialize(array3[i], this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this, this.m_binder); array4[i].assemId = this.GetAssemblyId(array4[i]); } else { array4[i] = WriteObjectInfo.Serialize(array2[i], this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this.m_binder); array4[i].assemId = this.GetAssemblyId(array4[i]); } } } this.Write(objectInfo, memberNameInfo, typeNameInfo, array, array2, array3, array4); }
private void Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) { object obj2 = objectInfo.obj; if (obj2 == null) { throw new ArgumentNullException("objectInfo.obj", Environment.GetResourceString("ArgumentNull_Obj")); } Type objectType = objectInfo.objectType; long objectId = objectInfo.objectId; if (object.ReferenceEquals(objectType, Converter.typeofString)) { memberNameInfo.NIobjectId = objectId; this.serWriter.WriteObjectString((int) objectId, obj2.ToString()); } else if (objectInfo.isArray) { this.WriteArray(objectInfo, memberNameInfo, null); } else { string[] strArray; Type[] typeArray; object[] objArray; objectInfo.GetMemberInfo(out strArray, out typeArray, out objArray); if (objectInfo.isSi || this.CheckTypeFormat(this.formatterEnums.FEtypeFormat, FormatterTypeStyle.TypesAlways)) { memberNameInfo.NItransmitTypeOnObject = true; memberNameInfo.NIisParentTypeOnObject = true; typeNameInfo.NItransmitTypeOnObject = true; typeNameInfo.NIisParentTypeOnObject = true; } WriteObjectInfo[] memberObjectInfos = new WriteObjectInfo[strArray.Length]; for (int i = 0; i < typeArray.Length; i++) { Type type; if (typeArray[i] != null) { type = typeArray[i]; } else if (objArray[i] != null) { type = this.GetType(objArray[i]); } else { type = Converter.typeofObject; } if ((this.ToCode(type) == InternalPrimitiveTypeE.Invalid) && !object.ReferenceEquals(type, Converter.typeofString)) { if (objArray[i] != null) { memberObjectInfos[i] = WriteObjectInfo.Serialize(objArray[i], this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this, this.m_binder); memberObjectInfos[i].assemId = this.GetAssemblyId(memberObjectInfos[i]); } else { memberObjectInfos[i] = WriteObjectInfo.Serialize(typeArray[i], this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this.m_binder); memberObjectInfos[i].assemId = this.GetAssemblyId(memberObjectInfos[i]); } } } this.Write(objectInfo, memberNameInfo, typeNameInfo, strArray, typeArray, objArray, memberObjectInfos); } }