当前位置: 首页>>代码示例>>C#>>正文


C# NameInfo.Dump方法代码示例

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


在下文中一共展示了NameInfo.Dump方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteKnownValueClass

        // Determines if a type is a primitive type, if it is it is written

        private bool WriteKnownValueClass(NameInfo memberNameInfo, NameInfo typeNameInfo, Object data) 
        {
#if _DEBUG                        
            SerTrace.Log( this, "WriteKnownValueClass Entry ",typeNameInfo.NIname," ",data," ",memberNameInfo.NIname);
            memberNameInfo.Dump("WriteKnownValueClass memberNameInfo");         
            typeNameInfo.Dump("WriteKnownValueClass typeNameInfo");
#endif            

            if (Object.ReferenceEquals(typeNameInfo.NItype, Converter.typeofString))
            {
                WriteString(memberNameInfo, typeNameInfo, data);
            }
            else
            {
                if (typeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.Invalid)
                {
                    SerTrace.Log( this, "WriteKnownValueClass Exit false");                     
                    return false;
                }
                else
                {
                    if (typeNameInfo.NIisArray) // null if an array
                        serWriter.WriteItem(memberNameInfo, typeNameInfo, data);
                    else
                    {
                        serWriter.WriteMember(memberNameInfo, typeNameInfo, data);
                    }
                }
            }

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

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

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

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

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

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

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

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

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


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