// [System.Security.SecurityCritical] // auto-generated internal static WriteObjectInfo Serialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SerializationBinder binder) { WriteObjectInfo soi = GetObjectInfo(serObjectInfoInit); soi.InitSerialize(objectType, surrogateSelector, context, serObjectInfoInit, converter, binder); return(soi); }
private static WriteObjectInfo GetObjectInfo(SerObjectInfoInit serObjectInfoInit) { WriteObjectInfo objectInfo = null; if (!serObjectInfoInit.oiPool.IsEmpty()) { objectInfo = (WriteObjectInfo)serObjectInfoInit.oiPool.Pop(); objectInfo.InternalInit(); //SerTrace.Log( "GetObjectInfo",objectInfo.objectInfoId," GetObjectInfo from pool"); } else { objectInfo = new WriteObjectInfo(); objectInfo.objectInfoId = serObjectInfoInit.objectInfoIdCount++; //SerTrace.Log( "GetObjectInfo",objectInfo.objectInfoId," GetObjectInfo new not from pool"); } return(objectInfo); }
// [System.Security.SecurityCritical] // auto-generated internal void WriteObjectByteArray(NameInfo memberNameInfo, NameInfo arrayNameInfo, WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, int length, int lowerBound, Byte[] byteA) { #if _DEBUG arrayNameInfo.Dump("WriteObjectByteArray arrayNameInfo"); arrayElemTypeNameInfo.Dump("WriteObjectByteArray arrayElemTypeNameInfo"); #endif InternalWriteItemNull(); WriteSingleArray(memberNameInfo, arrayNameInfo, objectInfo, arrayElemTypeNameInfo, length, lowerBound, byteA); }
internal void WriteRectangleArray(NameInfo memberNameInfo, NameInfo arrayNameInfo, WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, int rank, int[] lengthA, int[] lowerBoundA) { #if _DEBUG arrayNameInfo.Dump("WriteRectangleArray arrayNameInfo"); arrayElemTypeNameInfo.Dump("WriteRectangleArray arrayElemTypeNameInfo"); #endif InternalWriteItemNull(); BinaryArrayTypeEnum binaryArrayTypeEnum = BinaryArrayTypeEnum.Rectangular; Object typeInformation = null; int assemId = 0; BinaryTypeEnum binaryTypeEnum = BinaryConverter.GetBinaryTypeInfo(arrayElemTypeNameInfo.NItype, objectInfo, arrayElemTypeNameInfo.NIname, objectWriter, out typeInformation, out assemId); if (binaryArray == null) { binaryArray = new BinaryArray(); } for (int i = 0; i < rank; i++) { if (lowerBoundA[i] != 0) { binaryArrayTypeEnum = BinaryArrayTypeEnum.RectangularOffset; break; } } binaryArray.Set((int)arrayNameInfo.NIobjectId, rank, lengthA, lowerBoundA, binaryTypeEnum, typeInformation, binaryArrayTypeEnum, assemId); if (arrayNameInfo.NIobjectId > 0) { Ssz.Runtime.Serialization.BCLDebug.Trace("BINARY", "-----Top Level Object-----"); } #if _DEBUG binaryArray.Dump(); #endif binaryArray.Write(this); }
internal void WriteJaggedArray(NameInfo memberNameInfo, NameInfo arrayNameInfo, WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, int length, int lowerBound) { #if _DEBUG arrayNameInfo.Dump("WriteRectangleArray arrayNameInfo"); arrayElemTypeNameInfo.Dump("WriteRectangleArray arrayElemTypeNameInfo"); #endif InternalWriteItemNull(); BinaryArrayTypeEnum binaryArrayTypeEnum; Int32[] lengthA = new Int32[1]; lengthA[0] = length; Int32[] lowerBoundA = null; Object typeInformation = null; int assemId = 0; if (lowerBound == 0) { binaryArrayTypeEnum = BinaryArrayTypeEnum.Jagged; } else { binaryArrayTypeEnum = BinaryArrayTypeEnum.JaggedOffset; lowerBoundA = new Int32[1]; lowerBoundA[0] = lowerBound; } BinaryTypeEnum binaryTypeEnum = BinaryConverter.GetBinaryTypeInfo(arrayElemTypeNameInfo.NItype, objectInfo, arrayElemTypeNameInfo.NIname, objectWriter, out typeInformation, out assemId); if (binaryArray == null) { binaryArray = new BinaryArray(); } binaryArray.Set((int)arrayNameInfo.NIobjectId, (int)1, lengthA, lowerBoundA, binaryTypeEnum, typeInformation, binaryArrayTypeEnum, assemId); if (arrayNameInfo.NIobjectId > 0) { Ssz.Runtime.Serialization.BCLDebug.Trace("BINARY", "-----Top Level Object-----"); } #if _DEBUG binaryArray.Dump(); #endif binaryArray.Write(this); }
// [System.Security.SecurityCritical] // auto-generated internal void WriteSingleArray(NameInfo memberNameInfo, NameInfo arrayNameInfo, WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, int length, int lowerBound, Array array) { InternalWriteItemNull(); #if _DEBUG arrayNameInfo.Dump("WriteSingleArray arrayNameInfo"); arrayElemTypeNameInfo.Dump("WriteSingleArray arrayElemTypeNameInfo"); #endif BinaryArrayTypeEnum binaryArrayTypeEnum; Int32[] lengthA = new Int32[1]; lengthA[0] = length; Int32[] lowerBoundA = null; Object typeInformation = null; if (lowerBound == 0) { binaryArrayTypeEnum = BinaryArrayTypeEnum.Single; } else { binaryArrayTypeEnum = BinaryArrayTypeEnum.SingleOffset; lowerBoundA = new Int32[1]; lowerBoundA[0] = lowerBound; } int assemId; BinaryTypeEnum binaryTypeEnum = BinaryConverter.GetBinaryTypeInfo(arrayElemTypeNameInfo.NItype, objectInfo, arrayElemTypeNameInfo.NIname, objectWriter, out typeInformation, out assemId); if (binaryArray == null) { binaryArray = new BinaryArray(); } binaryArray.Set((int)arrayNameInfo.NIobjectId, (int)1, lengthA, lowerBoundA, binaryTypeEnum, typeInformation, binaryArrayTypeEnum, assemId); if (arrayNameInfo.NIobjectId > 0) { Ssz.Runtime.Serialization.BCLDebug.Trace("BINARY", "-----Top Level Object-----"); } #if _DEBUG binaryArray.Dump(); #endif binaryArray.Write(this); if (Converter.IsWriteAsByteArray(arrayElemTypeNameInfo.NIprimitiveTypeEnum) && (lowerBound == 0)) { //array is written out as an array of bytes if (arrayElemTypeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.Byte) { WriteBytes((Byte[])array); } else if (arrayElemTypeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.Char) { WriteChars((char[])array); } else { WriteArrayAsBytes(array, Converter.TypeLength(arrayElemTypeNameInfo.NIprimitiveTypeEnum)); } } }
internal static InternalNameSpaceE GetNameSpaceEnum(InternalPrimitiveTypeE code, Type type, WriteObjectInfo objectInfo, out String typeName) { SerTrace.Log("Converter", "GetNameSpaceEnum Entry ", ((Enum)code).ToString(), " type ", type); InternalNameSpaceE nameSpaceEnum = InternalNameSpaceE.None; typeName = null; if (code != InternalPrimitiveTypeE.Invalid) { switch (code) { case InternalPrimitiveTypeE.Boolean: case InternalPrimitiveTypeE.Char: case InternalPrimitiveTypeE.Byte: case InternalPrimitiveTypeE.Double: case InternalPrimitiveTypeE.Int16: case InternalPrimitiveTypeE.Int32: case InternalPrimitiveTypeE.Int64: case InternalPrimitiveTypeE.SByte: case InternalPrimitiveTypeE.Single: case InternalPrimitiveTypeE.UInt16: case InternalPrimitiveTypeE.UInt32: case InternalPrimitiveTypeE.UInt64: case InternalPrimitiveTypeE.DateTime: case InternalPrimitiveTypeE.TimeSpan: nameSpaceEnum = InternalNameSpaceE.XdrPrimitive; typeName = "System." + ToComType(code); break; case InternalPrimitiveTypeE.Decimal: nameSpaceEnum = InternalNameSpaceE.UrtSystem; typeName = "System." + ToComType(code); break; } } if ((nameSpaceEnum == InternalNameSpaceE.None) && ((object)type != null)) { if (Object.ReferenceEquals(type, typeofString)) { nameSpaceEnum = InternalNameSpaceE.XdrString; } else { if (objectInfo == null) { typeName = type.FullName; if (type.Assembly == urtAssembly) { nameSpaceEnum = InternalNameSpaceE.UrtSystem; } else { nameSpaceEnum = InternalNameSpaceE.UrtUser; } } else { typeName = objectInfo.GetTypeFullName(); if (objectInfo.GetAssemblyString().Equals(urtAssemblyString)) { nameSpaceEnum = InternalNameSpaceE.UrtSystem; } else { nameSpaceEnum = InternalNameSpaceE.UrtUser; } } } } SerTrace.Log("Converter", "GetNameSpaceEnum Exit ", ((Enum)nameSpaceEnum).ToString(), " typeName ", typeName); return(nameSpaceEnum); }
private static void PutObjectInfo(SerObjectInfoInit serObjectInfoInit, WriteObjectInfo objectInfo) { serObjectInfoInit.oiPool.Push(objectInfo); //SerTrace.Log( "PutObjectInfo",objectInfo.objectInfoId," PutObjectInfo to pool"); }