• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Binary.NameInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Runtime.Serialization.Formatters.Binary.NameInfo的典型用法代码示例。如果您正苦于以下问题:C# NameInfo类的具体用法?C# NameInfo怎么用?C# NameInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NameInfo类属于System.Runtime.Serialization.Formatters.Binary命名空间,在下文中一共展示了NameInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: 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


示例2: WriteObject

        //internal BinaryCrossAppDomainMap crossAppDomainMap;
 
        internal void WriteObject(NameInfo nameInfo, NameInfo typeNameInfo, int numMembers, String[] memberNames, Type[] memberTypes, WriteObjectInfo[] memberObjectInfos)
        { 
            InternalWriteItemNull(); 
            int assemId;
#if _DEBUG 
            nameInfo.Dump("WriteObject nameInfo");
            typeNameInfo.Dump("WriteObject typeNameInfo");
#endif
 
            int objectId = (int)nameInfo.NIobjectId;
 
            //if (objectId < 0) 
            //  objectId = --m_nestedObjectCount;
 
            if (objectId > 0)
            {
                BCLDebug.Trace("BINARY", "-----Top Level Object-----");
            } 

            String objectName = null; 
            if (objectId < 0) 
            {
                // Nested Object 
                objectName = typeNameInfo.NIname;
            }
            else
            { 
                // Non-Nested
                objectName = nameInfo.NIname; 
            } 
            SerTrace.Log( this, "WriteObject objectName ",objectName);
 
            if (objectMapTable == null)
            {
                objectMapTable = new Hashtable();
            } 

            ObjectMapInfo objectMapInfo = (ObjectMapInfo)objectMapTable[objectName]; 
 
            if (objectMapInfo != null && objectMapInfo.isCompatible(numMembers, memberNames, memberTypes))
            { 
                // Object
                if (binaryObject == null)
                    binaryObject = new BinaryObject();
                binaryObject.Set(objectId, objectMapInfo.objectId); 
#if _DEBUG
                binaryObject.Dump(); 
#endif 
                binaryObject.Write(this);
            } 
            else if (!typeNameInfo.NItransmitTypeOnObject)
            {

                // ObjectWithMap 
                if (binaryObjectWithMap == null)
                    binaryObjectWithMap = new BinaryObjectWithMap(); 
 
                // BCL types are not placed into table
                assemId = (int)typeNameInfo.NIassemId; 
                binaryObjectWithMap.Set(objectId, objectName, numMembers, memberNames, assemId);

                binaryObjectWithMap.Dump();
                binaryObjectWithMap.Write(this); 
                if (objectMapInfo == null)
                    objectMapTable.Add(objectName, new ObjectMapInfo(objectId, numMembers, memberNames, memberTypes)); 
            } 
            else
            { 
                // ObjectWithMapTyped
                BinaryTypeEnum[] binaryTypeEnumA = new BinaryTypeEnum[numMembers];
                Object[] typeInformationA = new Object[numMembers];
                int[] assemIdA = new int[numMembers]; 
                for (int i=0; i<numMembers; i++)
                { 
                    Object typeInformation = null; 

                    binaryTypeEnumA[i] = BinaryConverter.GetBinaryTypeInfo(memberTypes[i], memberObjectInfos[i], null, objectWriter, out typeInformation, out assemId); 
                    typeInformationA[i] = typeInformation;
                    assemIdA[i] = assemId;
                    SerTrace.Log( this, "WriteObject ObjectWithMapTyped memberNames "
                                  ,memberNames[i],", memberType ",memberTypes[i]," binaryTypeEnum ",((Enum)binaryTypeEnumA[i]).ToString() 
                                  ,", typeInformation ",typeInformationA[i]," assemId ",assemIdA[i]);
                } 
 
                if (binaryObjectWithMapTyped == null)
                    binaryObjectWithMapTyped = new BinaryObjectWithMapTyped(); 

                // BCL types are not placed in table
                assemId = (int)typeNameInfo.NIassemId;
                binaryObjectWithMapTyped.Set(objectId, objectName, numMembers,memberNames, binaryTypeEnumA, typeInformationA, assemIdA, assemId); 
#if _DEBUG
                binaryObjectWithMapTyped.Dump(); 
#endif 
                binaryObjectWithMapTyped.Write(this);
                if (objectMapInfo == null) 
                    objectMapTable.Add(objectName, new ObjectMapInfo(objectId, numMembers, memberNames, memberTypes));
            }
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:100,代码来源:BinaryFormatterWriter.cs


示例3: WriteArrayMember

        [System.Security.SecurityCritical]  // auto-generated
        private void WriteArrayMember(WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, Object data)
        {
            SerTrace.Log( this, "WriteArrayMember ",data," baseArrayName ",arrayElemTypeNameInfo.NIname);

            arrayElemTypeNameInfo.NIisArrayItem = true;

            if (CheckForNull(objectInfo, arrayElemTypeNameInfo, arrayElemTypeNameInfo, data))
                return;

            NameInfo actualTypeInfo = null;

            Type dataType = null;

            bool isObjectOnMember = false;

            if (arrayElemTypeNameInfo.NItransmitTypeOnMember)
                isObjectOnMember = true;

            if (!isObjectOnMember && !arrayElemTypeNameInfo.IsSealed)
            {
                dataType = GetType(data);
                if (!Object.ReferenceEquals(arrayElemTypeNameInfo.NItype, dataType))
                    isObjectOnMember = true;
            }

            if (isObjectOnMember)
            {
                // Object array, need type of member
                if ((object)dataType == null)
                    dataType = GetType(data);
                actualTypeInfo = TypeToNameInfo(dataType);
                actualTypeInfo.NItransmitTypeOnMember = true;
                actualTypeInfo.NIobjectId = arrayElemTypeNameInfo.NIobjectId;
                actualTypeInfo.NIassemId = arrayElemTypeNameInfo.NIassemId;
                actualTypeInfo.NIisArrayItem = true;
            }
            else
            {
                actualTypeInfo = arrayElemTypeNameInfo;
                actualTypeInfo.NIisArrayItem = true;
            }

            if (!WriteKnownValueClass(arrayElemTypeNameInfo, actualTypeInfo, data))
            {
                Object obj = data;
                bool assignUniqueIdForValueTypes = false;
                if (Object.ReferenceEquals(arrayElemTypeNameInfo.NItype, Converter.typeofObject))
                    assignUniqueIdForValueTypes = true;

                long arrayId = Schedule(obj, assignUniqueIdForValueTypes, actualTypeInfo.NItype);
                arrayElemTypeNameInfo.NIobjectId = arrayId;
                actualTypeInfo.NIobjectId = arrayId;
                if (arrayId < 1)
                {
                        WriteObjectInfo newObjectInfo = WriteObjectInfo.Serialize(obj, m_surrogates, m_context, serObjectInfoInit, m_formatterConverter, this, m_binder);
                        newObjectInfo.objectId = arrayId;
                        if (!Object.ReferenceEquals(arrayElemTypeNameInfo.NItype, Converter.typeofObject) && (object)Nullable.GetUnderlyingType(arrayElemTypeNameInfo.NItype) == null)
                            newObjectInfo.assemId = actualTypeInfo.NIassemId; 
                        else
                            newObjectInfo.assemId = GetAssemblyId(newObjectInfo);
                        SerTrace.Log( this, "WriteArrayMembers nested");
                        NameInfo typeNameInfo = TypeToNameInfo(newObjectInfo);
                        typeNameInfo.NIobjectId = arrayId;
                        newObjectInfo.objectId = arrayId;
                        Write(newObjectInfo, actualTypeInfo, typeNameInfo);

                        newObjectInfo.ObjectEnd();
                }
                else
                {
                    serWriter.WriteItemObjectRef(arrayElemTypeNameInfo, (int)arrayId);
                }

            }
            if (arrayElemTypeNameInfo.NItransmitTypeOnMember)
                PutNameInfo(actualTypeInfo);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:78,代码来源:BinaryObjectWriter.cs


示例4: WriteMembers

        [System.Security.SecurityCritical]  // auto-generated
        private void WriteMembers(NameInfo memberNameInfo,
                                  NameInfo memberTypeNameInfo,
                                  Object   memberData,
                                  WriteObjectInfo objectInfo,
                                  NameInfo typeNameInfo,
                                  WriteObjectInfo memberObjectInfo
                                 )
        {
            SerTrace.Log( this, "WriteMembers Entry memberType: ",memberTypeNameInfo.NIname," memberName: ",memberNameInfo.NIname," data: ",memberData," objectId: ",objectInfo.objectId, " Container object ",objectInfo.obj, " memberObjectinfo ",memberObjectInfo);
            Type memberType = memberNameInfo.NItype;
            bool assignUniqueIdToValueType = false;

            // Types are transmitted for a member as follows:
            // The member is of type object
            // The member object of type is ISerializable and
            //  Binary - Types always transmitted.

            if (Object.ReferenceEquals(memberType, Converter.typeofObject) || (object)Nullable.GetUnderlyingType(memberType) != null)
            {
                memberTypeNameInfo.NItransmitTypeOnMember  = true;
                memberNameInfo.NItransmitTypeOnMember  = true;              
            }

            if (CheckTypeFormat(formatterEnums.FEtypeFormat, FormatterTypeStyle.TypesAlways) || (objectInfo.isSi) )
            {
                memberTypeNameInfo.NItransmitTypeOnObject  = true;
                memberNameInfo.NItransmitTypeOnObject  = true;
                memberNameInfo.NIisParentTypeOnObject = true;
            }

            if (CheckForNull(objectInfo, memberNameInfo, memberTypeNameInfo, memberData))
            {
                return;
            }

            Object outObj = memberData;
            Type outType = null;

            // If member type does not equal data type, transmit type on object.
            if (memberTypeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.Invalid)
            {
                outType = GetType(outObj);
                if (!Object.ReferenceEquals(memberType, outType))
                {
                    memberTypeNameInfo.NItransmitTypeOnMember  = true;
                    memberNameInfo.NItransmitTypeOnMember  = true;    
                }
            }

            if (Object.ReferenceEquals(memberType, Converter.typeofObject))
            {
                assignUniqueIdToValueType = true;
                memberType = GetType(memberData);
                if (memberObjectInfo == null)
                    TypeToNameInfo(memberType, memberTypeNameInfo);
                else
                    TypeToNameInfo(memberObjectInfo, memberTypeNameInfo);                   
                SerTrace.Log( this, "WriteMembers memberType Object, actual memberType ",memberType);                                                                               
            }

            if (memberObjectInfo != null && memberObjectInfo.isArray)
            {
                // Array
                SerTrace.Log( this, "WriteMembers IsArray");

                long arrayId = 0;
                if ((object)outType == null)
                    outType = GetType(outObj);
                // outObj is an array. It can never be a value type..
                arrayId = Schedule(outObj, false, null, memberObjectInfo);
                if (arrayId > 0)
                {
                    // Array as object
                    SerTrace.Log( this, "WriteMembers Schedule 3");
                    memberNameInfo.NIobjectId = arrayId;
                    WriteObjectRef(memberNameInfo, arrayId); 
                }
                else
                {
                    // Nested Array
                    serWriter.WriteMemberNested(memberNameInfo);

                    memberObjectInfo.objectId = arrayId;
                    memberNameInfo.NIobjectId = arrayId;
                    WriteArray(memberObjectInfo, memberNameInfo, memberObjectInfo);
                    objectInfo.ObjectEnd();

                }
                SerTrace.Log( this, "WriteMembers Array Exit ");
                return;
            }

            if (!WriteKnownValueClass(memberNameInfo, memberTypeNameInfo, memberData))
            {
                SerTrace.Log( this, "WriteMembers Object ",memberData);

#if false
                // Value or NO_ID, need to explicitly check for IsValue because a top level
                // value class has an objectId of 1
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:BinaryObjectWriter.cs


示例5: Write

        [System.Security.SecurityCritical]  // auto-generated
        private void Write(WriteObjectInfo objectInfo,   
                           NameInfo memberNameInfo,          
                           NameInfo typeNameInfo,            
                           String[] memberNames,             
                           Type[] memberTypes,               
                           Object[] memberData,              
                           WriteObjectInfo[] memberObjectInfos)
        {
            SerTrace.Log( this, "Write 2 Entry obj ",objectInfo.obj,". objectId ",objectInfo.objectId,", objType ",typeNameInfo.NIname,", memberName ",memberNameInfo.NIname,", memberType ",typeNameInfo.NIname);

            int numItems = memberNames.Length;
            NameInfo topNameInfo = null;

            if (memberNameInfo != null)
            {
                SerTrace.Log( this, "Write 2 ObjectBegin, memberName ",memberNameInfo.NIname);
                memberNameInfo.NIobjectId = objectInfo.objectId;
                serWriter.WriteObject(memberNameInfo, typeNameInfo, numItems, memberNames, memberTypes, memberObjectInfos);
            }
            else if ((objectInfo.objectId == topId) && (topName != null))
            {
                SerTrace.Log( this, "Write 2 ObjectBegin, topId method name ",topName);
                topNameInfo = MemberToNameInfo(topName);
                topNameInfo.NIobjectId = objectInfo.objectId;
                serWriter.WriteObject(topNameInfo, typeNameInfo, numItems, memberNames, memberTypes, memberObjectInfos);
            }
            else
            {
                if (!Object.ReferenceEquals(objectInfo.objectType, Converter.typeofString))
                {
                    SerTrace.Log( this, "Write 2 ObjectBegin, default ", typeNameInfo.NIname);
                    typeNameInfo.NIobjectId = objectInfo.objectId;
                    serWriter.WriteObject(typeNameInfo, null, numItems, memberNames, memberTypes, memberObjectInfos);
                }
            }

            if (memberNameInfo.NIisParentTypeOnObject)
            {
                memberNameInfo.NItransmitTypeOnObject = true;
                memberNameInfo.NIisParentTypeOnObject = false;
            }
            else
                memberNameInfo.NItransmitTypeOnObject = false;


            // Write members
            for (int i=0; i<numItems; i++)
            {
                WriteMemberSetup(objectInfo, memberNameInfo, typeNameInfo, memberNames[i], memberTypes[i], memberData[i], memberObjectInfos[i]);
            }

            if (memberNameInfo != null)
            {
                memberNameInfo.NIobjectId = objectInfo.objectId;
                serWriter.WriteObjectEnd(memberNameInfo, typeNameInfo);
            }
            else if ((objectInfo.objectId == topId) && (topName != null))
            {
                serWriter.WriteObjectEnd(topNameInfo, typeNameInfo);
                PutNameInfo(topNameInfo);
            }
            else
            {
                if (!Object.ReferenceEquals(objectInfo.objectType, Converter.typeofString))
                {
                    serWriter.WriteObjectEnd(typeNameInfo, typeNameInfo);                       
                }
            }

            SerTrace.Log( this, "Write 2 Exit");
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:72,代码来源:BinaryObjectWriter.cs


示例6: PutNameInfo

 private void PutNameInfo(NameInfo nameInfo)
 {
     niPool.Push(nameInfo);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:BinaryObjectWriter.cs


示例7: TypeToNameInfo

 private void TypeToNameInfo(Type type, NameInfo nameInfo)
 {
     TypeToNameInfo(type, null, ToCode(type), nameInfo);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:BinaryObjectWriter.cs


示例8: WriteMemberObjectRef

        internal void WriteMemberObjectRef(NameInfo memberNameInfo, int idRef) 
        { 
            InternalWriteItemNull();
            if (memberReference == null) 
                memberReference = new MemberReference();
            memberReference.Set(idRef);

            if (memberNameInfo.NIisArrayItem) 
            {
                BCLDebug.Trace("BINARY", "-----item-----"); 
            } 
            else
            { 
                BCLDebug.Trace("BINARY", "-----",memberNameInfo.NIname,"-----");
            }
            memberReference.Dump();
 
            memberReference.Write(this);
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:19,代码来源:BinaryFormatterWriter.cs


示例9: WriteNullMember

        internal void WriteNullMember(NameInfo memberNameInfo, NameInfo typeNameInfo)
        { 
#if _DEBUG
            typeNameInfo.Dump("WriteNullMember typeNameInfo");
#endif
            InternalWriteItemNull(); 
            if (objectNull == null)
                objectNull = new ObjectNull(); 
 
            if (memberNameInfo.NIisArrayItem)
            { 
                BCLDebug.Trace("BINARY",  "-----item-----");
            }
            else
            { 
                objectNull.SetNullCount(1);
                BCLDebug.Trace("BINARY", "-----",memberNameInfo.NIname,"-----"); 
                objectNull.Dump(); 
                objectNull.Write(this);
                nullCount = 0; 
            }
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:22,代码来源:BinaryFormatterWriter.cs


示例10: WriteMember

        internal void WriteMember(NameInfo memberNameInfo, NameInfo typeNameInfo, Object value)
        { 
#if _DEBUG
            SerTrace.Log("BinaryWriter", "Write Member memberName ",memberNameInfo.NIname,", value ",value);
            memberNameInfo.Dump("WriteMember memberNameInfo");
            typeNameInfo.Dump("WriteMember typeNameInfo"); 
#endif
            InternalWriteItemNull(); 
            InternalPrimitiveTypeE typeInformation = typeNameInfo.NIprimitiveTypeEnum; 

            // Writes Members with primitive values 

            if (memberNameInfo.NItransmitTypeOnMember)
            {
                if (memberPrimitiveTyped == null) 
                    memberPrimitiveTyped = new MemberPrimitiveTyped();
                memberPrimitiveTyped.Set((InternalPrimitiveTypeE)typeInformation, value); 
 
                if (memberNameInfo.NIisArrayItem)
                { 
                    BCLDebug.Trace("BINARY",  "-----item-----");
                }
                else
                { 
                    BCLDebug.Trace("BINARY","-----",memberNameInfo.NIname,"-----");
                } 
                memberPrimitiveTyped.Dump(); 

                memberPrimitiveTyped.Write(this); 
            }
            else
            {
                if (memberPrimitiveUnTyped == null) 
                    memberPrimitiveUnTyped = new MemberPrimitiveUnTyped();
                memberPrimitiveUnTyped.Set(typeInformation, value); 
 
                if (memberNameInfo.NIisArrayItem)
                { 
                    BCLDebug.Trace("BINARY", "-----item-----");
                }
                else
                { 
                    BCLDebug.Trace("BINARY", "-----",memberNameInfo.NIname,"-----");
                } 
                memberPrimitiveUnTyped.Dump(); 

                memberPrimitiveUnTyped.Write(this); 

            }
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:50,代码来源:BinaryFormatterWriter.cs


示例11: 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


示例12: WriteRectangleArray

        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)
            {
                BCLDebug.Trace("BINARY", "-----Top Level Object-----");
            } 
#if _DEBUG
            binaryArray.Dump(); 
#endif 
            binaryArray.Write(this);
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:37,代码来源:BinaryFormatterWriter.cs


示例13: WriteJaggedArray

        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)
            { 
                BCLDebug.Trace("BINARY", "-----Top Level Object-----");
            }
#if _DEBUG
            binaryArray.Dump(); 
#endif
            binaryArray.Write(this); 
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:40,代码来源:BinaryFormatterWriter.cs


示例14: WriteSingleArray

        [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)
            {
                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));
            }
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:53,代码来源:BinaryFormatterWriter.cs


示例15: WriteString

        // Writes a string into the XML stream
        private void WriteString(NameInfo memberNameInfo, NameInfo typeNameInfo, Object stringObject)
        {
            SerTrace.Log( this, "WriteString stringObject ",stringObject," memberName ",memberNameInfo.NIname);
            bool isFirstTime = true;

            long stringId = -1;

            if (!CheckTypeFormat(formatterEnums.FEtypeFormat, FormatterTypeStyle.XsdString))
                stringId= InternalGetId(stringObject, false, null, out isFirstTime);

            typeNameInfo.NIobjectId = stringId;
            SerTrace.Log( this, "WriteString stringId ",stringId," isFirstTime ",isFirstTime);

            if ((isFirstTime) || (stringId < 0))
                serWriter.WriteMemberString(memberNameInfo, typeNameInfo, (String)stringObject);
            else
                WriteObjectRef(memberNameInfo, stringId);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:19,代码来源:BinaryObjectWriter.cs


示例16: 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


示例17: WriteMemberNested

 internal void WriteMemberNested(NameInfo memberNameInfo)
 { 
     InternalWriteItemNull();
     if (memberNameInfo.NIisArrayItem)
     {
         BCLDebug.Trace("BINARY", "-----item-----"); 
     }
     else 
     { 
         BCLDebug.Trace("BINARY", "-----",memberNameInfo.NIname,"-----");
     } 
 }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:12,代码来源:BinaryFormatterWriter.cs


示例18: WriteMemberString

 internal void WriteMemberString(NameInfo memberNameInfo, NameInfo typeNameInfo, String value)
 { 
     InternalWriteItemNull();
     if (memberNameInfo.NIisArrayItem) 
     { 
         BCLDebug.Trace("BINARY", "-----item-----");
     } 
     else
     {
         BCLDebug.Trace("BINARY", "-----",memberNameInfo.NIname,"-----");
     } 
     WriteObjectString((int)typeNameInfo.NIobjectId, value);
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:13,代码来源:BinaryFormatterWriter.cs


示例19: GetNameInfo

        private NameInfo GetNameInfo()
        {
            NameInfo nameInfo = null;

            if (!niPool.IsEmpty())
            {
                nameInfo = (NameInfo)niPool.Pop();
                nameInfo.Init();
            }
            else
                nameInfo = new NameInfo();

            return nameInfo;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:BinaryObjectWriter.cs


示例20: WriteItem

 internal void WriteItem(NameInfo itemNameInfo, NameInfo typeNameInfo, Object value)
 { 
     InternalWriteItemNull();
     WriteMember(itemNameInfo, typeNameInfo, value);
 }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:5,代码来源:BinaryFormatterWriter.cs



注:本文中的System.Runtime.Serialization.Formatters.Binary.NameInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Binary.ParseRecord类代码示例发布时间:2022-05-26
下一篇:
C# Binary.BinaryFormatter类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap