本文整理汇总了C#中System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo类的典型用法代码示例。如果您正苦于以下问题:C# WriteObjectInfo类的具体用法?C# WriteObjectInfo怎么用?C# WriteObjectInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WriteObjectInfo类属于System.Runtime.Serialization.Formatters.Binary命名空间,在下文中一共展示了WriteObjectInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetAssemblyId
private long GetAssemblyId(WriteObjectInfo objectInfo)
{
if (this.assemblyToIdTable == null)
{
this.assemblyToIdTable = new Hashtable(5);
}
long num = 0L;
bool isNew = false;
string assemblyString = objectInfo.GetAssemblyString();
string str2 = assemblyString;
if (assemblyString.Length == 0)
{
return 0L;
}
if (assemblyString.Equals(Converter.urtAssemblyString))
{
return 0L;
}
if (this.assemblyToIdTable.ContainsKey(assemblyString))
{
num = (long) this.assemblyToIdTable[assemblyString];
isNew = false;
}
else
{
num = this.InternalGetId("___AssemblyString___" + assemblyString, false, null, out isNew);
this.assemblyToIdTable[assemblyString] = num;
}
this.serWriter.WriteAssembly(objectInfo.objectType, str2, (int) num, isNew);
return num;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:ObjectWriter.cs
示例2: GetBinaryTypeInfo
internal static BinaryTypeEnum GetBinaryTypeInfo(Type type, WriteObjectInfo objectInfo, string typeName, ObjectWriter objectWriter, out object typeInformation, out int assemId)
{
BinaryTypeEnum primitive;
assemId = 0;
typeInformation = null;
if (object.ReferenceEquals(type, Converter.typeofString))
{
return BinaryTypeEnum.String;
}
if (((objectInfo == null) || ((objectInfo != null) && !objectInfo.isSi)) && object.ReferenceEquals(type, Converter.typeofObject))
{
return BinaryTypeEnum.Object;
}
if (object.ReferenceEquals(type, Converter.typeofStringArray))
{
return BinaryTypeEnum.StringArray;
}
if (object.ReferenceEquals(type, Converter.typeofObjectArray))
{
return BinaryTypeEnum.ObjectArray;
}
if (Converter.IsPrimitiveArray(type, out typeInformation))
{
return BinaryTypeEnum.PrimitiveArray;
}
InternalPrimitiveTypeE ee = objectWriter.ToCode(type);
switch (ee)
{
case InternalPrimitiveTypeE.Invalid:
{
string fullName = null;
if (objectInfo == null)
{
fullName = type.Assembly.FullName;
typeInformation = type.FullName;
}
else
{
fullName = objectInfo.GetAssemblyString();
typeInformation = objectInfo.GetTypeFullName();
}
if (fullName.Equals(Converter.urtAssemblyString))
{
primitive = BinaryTypeEnum.ObjectUrt;
assemId = 0;
return primitive;
}
primitive = BinaryTypeEnum.ObjectUser;
assemId = (int) objectInfo.assemId;
if (assemId == 0)
{
throw new SerializationException(Environment.GetResourceString("Serialization_AssemblyId", new object[] { typeInformation }));
}
return primitive;
}
}
primitive = BinaryTypeEnum.Primitive;
typeInformation = ee;
return primitive;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:BinaryConverter.cs
示例3: CheckForNull
private bool CheckForNull(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo, object data)
{
bool flag = false;
if (data == null)
{
flag = true;
}
if (flag && ((((this.formatterEnums.FEserializerTypeEnum == InternalSerializerTypeE.Binary) || memberNameInfo.NIisArrayItem) || (memberNameInfo.NItransmitTypeOnObject || memberNameInfo.NItransmitTypeOnMember)) || (objectInfo.isSi || this.CheckTypeFormat(this.formatterEnums.FEtypeFormat, FormatterTypeStyle.TypesAlways))))
{
if (typeNameInfo.NIisArrayItem)
{
if (typeNameInfo.NIarrayEnum == InternalArrayTypeE.Single)
{
this.serWriter.WriteDelayedNullItem();
return flag;
}
this.serWriter.WriteNullItem(memberNameInfo, typeNameInfo);
return flag;
}
this.serWriter.WriteNullMember(memberNameInfo, typeNameInfo);
}
return flag;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:ObjectWriter.cs
示例4: WriteObjectByteArray
[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);
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:10,代码来源:BinaryFormatterWriter.cs
示例5: Schedule
private long Schedule(Object obj, bool assignUniqueIdToValueType, Type type, WriteObjectInfo objectInfo)
{
SerTrace.Log( this, "Schedule Entry obj ",obj," type ", type, " objectInfo ",objectInfo);
bool isNew;
long id;
if (obj==null)
{
SerTrace.Log(this, "Schedule Obj Null, id = 0 ");
return 0;
}
id = InternalGetId(obj, assignUniqueIdToValueType, type, out isNew);
if (isNew && id > 0)
{
if (objectInfo == null)
m_objectQueue.Enqueue(obj);
else
m_objectQueue.Enqueue(objectInfo);
}
SerTrace.Log( this, "Schedule Exit, id: ",id," isNew: ",isNew);
return id;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:27,代码来源:BinaryObjectWriter.cs
示例6: WriteRectangle
[System.Security.SecurityCritical] // auto-generated
private void WriteRectangle(WriteObjectInfo objectInfo, int rank, int[] maxA, System.Array array, NameInfo arrayElemNameTypeInfo, int[] lowerBoundA)
{
IndexTraceMessage("WriteRectangle Entry "+rank, maxA);
int[] currentA = new int[rank];
int[] indexMap = null;
bool isLowerBound = false;
if (lowerBoundA != null)
{
for (int i=0; i<rank; i++)
{
if (lowerBoundA[i] != 0)
isLowerBound = true;
}
}
if (isLowerBound)
indexMap = new int[rank];
bool isLoop = true;
while (isLoop)
{
isLoop = false;
if (isLowerBound)
{
for (int i=0; i<rank; i++)
{
indexMap[i] = currentA[i]+lowerBoundA[i];
}
WriteArrayMember(objectInfo, arrayElemNameTypeInfo, array.GetValue(indexMap));
}
else
WriteArrayMember(objectInfo, arrayElemNameTypeInfo, array.GetValue(currentA));
for (int irank = rank-1; irank>-1; irank--)
{
// Find the current or lower dimension which can be incremented.
if (currentA[irank] < maxA[irank]-1)
{
// The current dimension is at maximum. Increase the next lower dimension by 1
currentA[irank]++;
if (irank < rank-1)
{
// The current dimension and higher dimensions are zeroed.
for (int i = irank+1; i<rank; i++)
currentA[i] = 0;
}
isLoop = true;
break;
}
}
}
SerTrace.Log( this, "WriteRectangle Exit ");
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:54,代码来源:BinaryObjectWriter.cs
示例7: GetBinaryTypeInfo
// From the type create the BinaryTypeEnum and typeInformation which describes the type on the wire
internal static BinaryTypeEnum GetBinaryTypeInfo(Type type, WriteObjectInfo objectInfo, String typeName, ObjectWriter objectWriter, out Object typeInformation, out int assemId)
{
SerTrace.Log("BinaryConverter", "GetBinaryTypeInfo Entry type ",type,", typeName ",typeName," objectInfo "+objectInfo);
BinaryTypeEnum binaryTypeEnum;
assemId = 0;
typeInformation = null;
if (Object.ReferenceEquals(type, Converter.typeofString))
binaryTypeEnum = BinaryTypeEnum.String;
else if (((objectInfo == null) || ((objectInfo != null) && !objectInfo.isSi))
&& (Object.ReferenceEquals(type, Converter.typeofObject)))
{
// If objectInfo.Si then can be a surrogate which will change the type
binaryTypeEnum = BinaryTypeEnum.Object;
}
else if (Object.ReferenceEquals(type, Converter.typeofStringArray))
binaryTypeEnum = BinaryTypeEnum.StringArray;
else if (Object.ReferenceEquals(type, Converter.typeofObjectArray))
binaryTypeEnum = BinaryTypeEnum.ObjectArray;
else if (Converter.IsPrimitiveArray(type, out typeInformation))
binaryTypeEnum = BinaryTypeEnum.PrimitiveArray;
else
{
InternalPrimitiveTypeE primitiveTypeEnum = objectWriter.ToCode(type);
switch (primitiveTypeEnum)
{
case InternalPrimitiveTypeE.Invalid:
String assembly = null;
if (objectInfo == null)
{
assembly = type.Assembly.FullName;
typeInformation = type.FullName;
}
else
{
assembly = objectInfo.GetAssemblyString();
typeInformation = objectInfo.GetTypeFullName();
}
if (assembly.Equals(Converter.urtAssemblyString))
{
binaryTypeEnum = BinaryTypeEnum.ObjectUrt;
assemId = 0;
}
else
{
binaryTypeEnum = BinaryTypeEnum.ObjectUser;
Contract.Assert(objectInfo!=null, "[BinaryConverter.GetBinaryTypeInfo]objectInfo null for user object");
assemId = (int)objectInfo.assemId;
if (assemId == 0)
throw new SerializationException(Environment.GetResourceString("Serialization_AssemblyId",typeInformation));
}
break;
default:
binaryTypeEnum = BinaryTypeEnum.Primitive;
typeInformation = primitiveTypeEnum;
break;
}
}
SerTrace.Log( "BinaryConverter", "GetBinaryTypeInfo Exit ",((Enum)binaryTypeEnum).ToString(),", typeInformation ",typeInformation," assemId ",assemId);
return binaryTypeEnum;
}
开发者ID:wsky,项目名称:System.Runtime.Remoting,代码行数:66,代码来源:BinaryCommonClasses.cs
示例8: WriteJaggedArray
internal void WriteJaggedArray(NameInfo memberNameInfo, NameInfo arrayNameInfo, WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, int length, int lowerBound)
{
BinaryArrayTypeEnum jagged;
this.InternalWriteItemNull();
int[] lengthA = new int[] { length };
int[] lowerBoundA = null;
object typeInformation = null;
int assemId = 0;
if (lowerBound == 0)
{
jagged = BinaryArrayTypeEnum.Jagged;
}
else
{
jagged = BinaryArrayTypeEnum.JaggedOffset;
lowerBoundA = new int[] { lowerBound };
}
BinaryTypeEnum binaryTypeEnum = BinaryConverter.GetBinaryTypeInfo(arrayElemTypeNameInfo.NItype, objectInfo, arrayElemTypeNameInfo.NIname, this.objectWriter, out typeInformation, out assemId);
if (this.binaryArray == null)
{
this.binaryArray = new BinaryArray();
}
this.binaryArray.Set((int) arrayNameInfo.NIobjectId, 1, lengthA, lowerBoundA, binaryTypeEnum, typeInformation, jagged, assemId);
long nIobjectId = arrayNameInfo.NIobjectId;
this.binaryArray.Write(this);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:__BinaryWriter.cs
示例9: WriteArray
[System.Security.SecurityCritical] // auto-generated
private void WriteArray(WriteObjectInfo objectInfo, NameInfo memberNameInfo, WriteObjectInfo memberObjectInfo)
{
SerTrace.Log( this, "WriteArray Entry ",objectInfo.obj," ",objectInfo.objectId);
bool isAllocatedMemberNameInfo = false;
if (memberNameInfo == null)
{
memberNameInfo = TypeToNameInfo(objectInfo);
isAllocatedMemberNameInfo = true;
}
memberNameInfo.NIisArray = true;
long objectId = objectInfo.objectId;
memberNameInfo.NIobjectId = objectInfo.objectId;
// Get array type
System.Array array = (System.Array)objectInfo.obj;
//Type arrayType = array.GetType();
Type arrayType = objectInfo.objectType;
// Get type of array element
Type arrayElemType = arrayType.GetElementType();
WriteObjectInfo arrayElemObjectInfo = null;
if (!arrayElemType.IsPrimitive)
{
arrayElemObjectInfo = WriteObjectInfo.Serialize(arrayElemType, m_surrogates, m_context, serObjectInfoInit, m_formatterConverter, m_binder);
arrayElemObjectInfo.assemId = GetAssemblyId(arrayElemObjectInfo);
}
NameInfo arrayElemTypeNameInfo = null;
if (arrayElemObjectInfo == null)
arrayElemTypeNameInfo = TypeToNameInfo(arrayElemType);
else
arrayElemTypeNameInfo = TypeToNameInfo(arrayElemObjectInfo);
arrayElemTypeNameInfo.NIisArray = arrayElemTypeNameInfo.NItype.IsArray;
NameInfo arrayNameInfo = memberNameInfo;
arrayNameInfo.NIobjectId = objectId;
arrayNameInfo.NIisArray = true;
arrayElemTypeNameInfo.NIobjectId = objectId;
arrayElemTypeNameInfo.NItransmitTypeOnMember = memberNameInfo.NItransmitTypeOnMember;
arrayElemTypeNameInfo.NItransmitTypeOnObject = memberNameInfo.NItransmitTypeOnObject;
arrayElemTypeNameInfo.NIisParentTypeOnObject = memberNameInfo.NIisParentTypeOnObject;
// Get rank and length information
int rank = array.Rank;
int[] lengthA = new int[rank];
int[] lowerBoundA = new int[rank];
int[] upperBoundA = new int[rank];
for (int i=0; i<rank; i++)
{
lengthA[i] = array.GetLength(i);
lowerBoundA[i] = array.GetLowerBound(i);
upperBoundA[i] = array.GetUpperBound(i);
}
InternalArrayTypeE arrayEnum;
if (arrayElemTypeNameInfo.NIisArray)
{
if (rank == 1)
arrayEnum = InternalArrayTypeE.Jagged;
else
arrayEnum = InternalArrayTypeE.Rectangular;
}
else if (rank == 1)
arrayEnum = InternalArrayTypeE.Single;
else
arrayEnum = InternalArrayTypeE.Rectangular;
arrayElemTypeNameInfo.NIarrayEnum = arrayEnum;
SerTrace.Log( this, "WriteArray ArrayInfo type ",arrayType," rank ",rank);
// Byte array
if ((Object.ReferenceEquals(arrayElemType, Converter.typeofByte)) && (rank == 1) && (lowerBoundA[0] == 0))
{
serWriter.WriteObjectByteArray(memberNameInfo, arrayNameInfo, arrayElemObjectInfo, arrayElemTypeNameInfo, lengthA[0], lowerBoundA[0], (byte[])array);
return;
}
if (Object.ReferenceEquals(arrayElemType, Converter.typeofObject) || (object)Nullable.GetUnderlyingType(arrayElemType) != null)
{
memberNameInfo.NItransmitTypeOnMember = true;
arrayElemTypeNameInfo.NItransmitTypeOnMember = true;
}
if (CheckTypeFormat(formatterEnums.FEtypeFormat, FormatterTypeStyle.TypesAlways))
{
memberNameInfo.NItransmitTypeOnObject = true;
arrayElemTypeNameInfo.NItransmitTypeOnObject = true;
}
if (arrayEnum == InternalArrayTypeE.Single)
{
// Single Dimensional array
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:BinaryObjectWriter.cs
示例10: PutObjectInfo
private static void PutObjectInfo(SerObjectInfoInit serObjectInfoInit, WriteObjectInfo objectInfo)
{
serObjectInfoInit.oiPool.Push(objectInfo);
//SerTrace.Log( "PutObjectInfo",objectInfo.objectInfoId," PutObjectInfo to pool");
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:BinaryObjectInfo.cs
示例11: TypeToNameInfo
private NameInfo TypeToNameInfo(WriteObjectInfo objectInfo, NameInfo nameInfo)
{
return TypeToNameInfo(objectInfo.objectType, objectInfo, ToCode(objectInfo.objectType), nameInfo);
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:BinaryObjectWriter.cs
示例12: WriteSingleArray
internal void WriteSingleArray(NameInfo memberNameInfo, NameInfo arrayNameInfo, WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, int length, int lowerBound, Array array)
{
BinaryArrayTypeEnum single;
int num;
this.InternalWriteItemNull();
int[] lengthA = new int[] { length };
int[] lowerBoundA = null;
object typeInformation = null;
if (lowerBound == 0)
{
single = BinaryArrayTypeEnum.Single;
}
else
{
single = BinaryArrayTypeEnum.SingleOffset;
lowerBoundA = new int[] { lowerBound };
}
BinaryTypeEnum binaryTypeEnum = BinaryConverter.GetBinaryTypeInfo(arrayElemTypeNameInfo.NItype, objectInfo, arrayElemTypeNameInfo.NIname, this.objectWriter, out typeInformation, out num);
if (this.binaryArray == null)
{
this.binaryArray = new BinaryArray();
}
this.binaryArray.Set((int) arrayNameInfo.NIobjectId, 1, lengthA, lowerBoundA, binaryTypeEnum, typeInformation, single, num);
long nIobjectId = arrayNameInfo.NIobjectId;
this.binaryArray.Write(this);
if (Converter.IsWriteAsByteArray(arrayElemTypeNameInfo.NIprimitiveTypeEnum) && (lowerBound == 0))
{
if (arrayElemTypeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.Byte)
{
this.WriteBytes((byte[]) array);
}
else if (arrayElemTypeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.Char)
{
this.WriteChars((char[]) array);
}
else
{
this.WriteArrayAsBytes(array, Converter.TypeLength(arrayElemTypeNameInfo.NIprimitiveTypeEnum));
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:41,代码来源:__BinaryWriter.cs
示例13: GetObjectInfo
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;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:19,代码来源:BinaryObjectInfo.cs
示例14: WriteRectangleArray
internal void WriteRectangleArray(NameInfo memberNameInfo, NameInfo arrayNameInfo, WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, int rank, int[] lengthA, int[] lowerBoundA)
{
this.InternalWriteItemNull();
BinaryArrayTypeEnum rectangular = BinaryArrayTypeEnum.Rectangular;
object typeInformation = null;
int assemId = 0;
BinaryTypeEnum binaryTypeEnum = BinaryConverter.GetBinaryTypeInfo(arrayElemTypeNameInfo.NItype, objectInfo, arrayElemTypeNameInfo.NIname, this.objectWriter, out typeInformation, out assemId);
if (this.binaryArray == null)
{
this.binaryArray = new BinaryArray();
}
for (int i = 0; i < rank; i++)
{
if (lowerBoundA[i] != 0)
{
rectangular = BinaryArrayTypeEnum.RectangularOffset;
break;
}
}
this.binaryArray.Set((int) arrayNameInfo.NIobjectId, rank, lengthA, lowerBoundA, binaryTypeEnum, typeInformation, rectangular, assemId);
long nIobjectId = arrayNameInfo.NIobjectId;
this.binaryArray.Write(this);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:__BinaryWriter.cs
示例15: WriteObjectByteArray
internal void WriteObjectByteArray(NameInfo memberNameInfo, NameInfo arrayNameInfo, WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, int length, int lowerBound, byte[] byteA)
{
this.InternalWriteItemNull();
this.WriteSingleArray(memberNameInfo, arrayNameInfo, objectInfo, arrayElemTypeNameInfo, length, lowerBound, byteA);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:__BinaryWriter.cs
示例16: WriteObject
internal void WriteObject(NameInfo nameInfo, NameInfo typeNameInfo, int numMembers, string[] memberNames, Type[] memberTypes, WriteObjectInfo[] memberObjectInfos)
{
this.InternalWriteItemNull();
int nIobjectId = (int) nameInfo.NIobjectId;
string name = null;
if (nIobjectId < 0)
{
name = typeNameInfo.NIname;
}
else
{
name = nameInfo.NIname;
}
if (this.objectMapTable == null)
{
this.objectMapTable = new Hashtable();
}
ObjectMapInfo info = (ObjectMapInfo) this.objectMapTable[name];
if ((info != null) && info.isCompatible(numMembers, memberNames, memberTypes))
{
if (this.binaryObject == null)
{
this.binaryObject = new BinaryObject();
}
this.binaryObject.Set(nIobjectId, info.objectId);
this.binaryObject.Write(this);
}
else
{
int nIassemId;
if (!typeNameInfo.NItransmitTypeOnObject)
{
if (this.binaryObjectWithMap == null)
{
this.binaryObjectWithMap = new BinaryObjectWithMap();
}
nIassemId = (int) typeNameInfo.NIassemId;
this.binaryObjectWithMap.Set(nIobjectId, name, numMembers, memberNames, nIassemId);
this.binaryObjectWithMap.Dump();
this.binaryObjectWithMap.Write(this);
if (info == null)
{
this.objectMapTable.Add(name, new ObjectMapInfo(nIobjectId, numMembers, memberNames, memberTypes));
}
}
else
{
BinaryTypeEnum[] binaryTypeEnumA = new BinaryTypeEnum[numMembers];
object[] typeInformationA = new object[numMembers];
int[] memberAssemIds = new int[numMembers];
for (int i = 0; i < numMembers; i++)
{
object typeInformation = null;
binaryTypeEnumA[i] = BinaryConverter.GetBinaryTypeInfo(memberTypes[i], memberObjectInfos[i], null, this.objectWriter, out typeInformation, out nIassemId);
typeInformationA[i] = typeInformation;
memberAssemIds[i] = nIassemId;
}
if (this.binaryObjectWithMapTyped == null)
{
this.binaryObjectWithMapTyped = new BinaryObjectWithMapTyped();
}
nIassemId = (int) typeNameInfo.NIassemId;
this.binaryObjectWithMapTyped.Set(nIobjectId, name, numMembers, memberNames, binaryTypeEnumA, typeInformationA, memberAssemIds, nIassemId);
this.binaryObjectWithMapTyped.Write(this);
if (info == null)
{
this.objectMapTable.Add(name, new ObjectMapInfo(nIobjectId, numMembers, memberNames, memberTypes));
}
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:71,代码来源:__BinaryWriter.cs
示例17: CheckForNull
// Writes a null member into the stream
private bool CheckForNull(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo, Object data)
{
#if _DEBUG
SerTrace.Log( this, "CheckForNull Entry data ",Util.PString(data),", memberType ",Util.PString(typeNameInfo.NItype));
#endif
bool isNull = false;
if (data == null) // || Convert.IsDBNull(data)
isNull = true;
// Optimization, Null members are only written for Binary
if ((isNull) && (((formatterEnums.FEserializerTypeEnum == InternalSerializerTypeE.Binary)) ||
memberNameInfo.NIisArrayItem ||
memberNameInfo.NItransmitTypeOnObject ||
memberNameInfo.NItransmitTypeOnMember ||
objectInfo.isSi ||
(CheckTypeFormat(formatterEnums.FEtypeFormat, FormatterTypeStyle.TypesAlways))))
{
SerTrace.Log( this, "CheckForNull Write");
if (typeNameInfo.NIisArrayItem)
{
if (typeNameInfo.NIarrayEnum == InternalArrayTypeE.Single)
serWriter.WriteDelayedNullItem();
else
serWriter.WriteNullItem(memberNameInfo, typeNameInfo);
}
else
serWriter.WriteNullMember(memberNameInfo, typeNameInfo);
}
SerTrace.Log( this, "CheckForNull Exit ",isNull);
return isNull;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:35,代码来源:BinaryObjectWriter.cs
示例18: Write
[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
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:BinaryObjectWriter.cs
示例19: WriteMemberSetup
[System.Security.SecurityCritical] // auto-generated
private void WriteMemberSetup(WriteObjectInfo objectInfo,
NameInfo memberNameInfo,
NameInfo typeNameInfo,
String memberName,
Type memberType,
Object memberData,
WriteObjectInfo memberObjectInfo
)
{
NameInfo newMemberNameInfo = MemberToNameInfo(memberName);
// newMemberNameInfo contains the member type
if (memberObjectInfo != null)
newMemberNameInfo.NIassemId = memberObjectInfo.assemId;
newMemberNameInfo.NItype = memberType;
// newTypeNameInfo contains the data type
NameInfo newTypeNameInfo = null;
if (memberObjectInfo == null)
{
newTypeNameInfo = TypeToNameInfo(memberType);
}
else
{
newTypeNameInfo = TypeToNameInfo(memberObjectInfo);
}
newMemberNameInfo.NItransmitTypeOnObject = memberNameInfo.NItransmitTypeOnObject;
newMemberNameInfo.NIisParentTypeOnObject = memberNameInfo.NIisParentTypeOnObject;
WriteMembers(newMemberNameInfo, newTypeNameInfo, memberData, objectInfo, typeNameInfo, memberObjectInfo);
PutNameInfo(newMemberNameInfo);
PutNameInfo(newTypeNameInfo);
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:34,代码来源:BinaryObjectWriter.cs
示例20: GetAssemblyId
private long GetAssemblyId(WriteObjectInfo objectInfo)
{
//use objectInfo to get assembly string with new criteria
SerTrace.Log( this, "GetAssemblyId Entry ",objectInfo.objectType," isSi ",objectInfo.isSi);
if (assemblyToIdTable == null)
assemblyToIdTable = new Hashtable(5);
long assemId = 0;
bool isNew = false;
String assemblyString = objectInfo.GetAssemblyString();
String serializedAssemblyString = assemblyString;
if (assemblyString.Length == 0)
{
assemId = 0;
}
else if (assemblyString.Equals(Converter.urtAssemblyString))
{
// Urt type is an assemId of 0. No assemblyString needs
// to be sent
SerTrace.Log( this, "GetAssemblyId urt Assembly String ");
assemId = 0;
}
else
{
// Assembly needs to be sent
// Need to prefix assembly string to separate the string names from the
// assemblyName string names. That is a string can have the same value
// as an assemblyNameString, but it is serialized differently
if (assemblyToIdTable.ContainsKey(assemblyString))
{
assemId = (long)assemblyToIdTable[assemblyString];
isNew = false;
}
else
{
assemId = InternalGetId("___AssemblyString___"+assemblyString, false, null, out isNew);
assemblyToIdTable[assemblyString] = assemId;
}
serWriter.WriteAssembly(objectInfo.objectType, serializedAssemblyString, (int)assemId, isNew);
}
SerTrace.Log( this, "GetAssemblyId Exit id ",assemId," isNew ",isNew," assemblyString ",serializedAssemblyString);
return assemId;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:46,代码来源:BinaryObjectWriter.cs
注:本文中的System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论