當前位置: 首頁>>代碼示例>>C#>>正文


C# WriteObjectInfo.GetTypeFullName方法代碼示例

本文整理匯總了C#中System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.GetTypeFullName方法的典型用法代碼示例。如果您正苦於以下問題:C# WriteObjectInfo.GetTypeFullName方法的具體用法?C# WriteObjectInfo.GetTypeFullName怎麽用?C# WriteObjectInfo.GetTypeFullName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo的用法示例。


在下文中一共展示了WriteObjectInfo.GetTypeFullName方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

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

示例2: GetNameSpaceEnum

        internal static InternalNameSpaceE GetNameSpaceEnum(InternalPrimitiveTypeE code, Type type, WriteObjectInfo objectInfo, out string typeName)
        {
            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) && type != null)
            {
                if (ReferenceEquals(type, s_typeofString))
                {
                    nameSpaceEnum = InternalNameSpaceE.XdrString;
                }
                else
                {
                    if (objectInfo == null)
                    {
                        typeName = type.FullName;
                        nameSpaceEnum = type.GetTypeInfo().Assembly == s_urtAssembly ? InternalNameSpaceE.UrtSystem : InternalNameSpaceE.UrtUser;
                    }
                    else
                    {
                        typeName = objectInfo.GetTypeFullName();
                        nameSpaceEnum = objectInfo.GetAssemblyString().Equals(s_urtAssemblyString) ? InternalNameSpaceE.UrtSystem : InternalNameSpaceE.UrtUser;
                    }
                }
            }

            return nameSpaceEnum;
        }
開發者ID:Corillian,項目名稱:corefx,代碼行數:57,代碼來源:Converter.cs

示例3: TypeToNameInfo

        // Transforms a type to the serialized string form. URT Primitive types are converted to XMLData Types
        private NameInfo TypeToNameInfo(Type type, WriteObjectInfo objectInfo, InternalPrimitiveTypeE code, NameInfo nameInfo)
        {
            SerTrace.Log( this, "TypeToNameInfo Entry type ",type,", objectInfo ",objectInfo,", code ", ((Enum)code).ToString());
            if (nameInfo == null)
                nameInfo = GetNameInfo();
            else
                nameInfo.Init();

            if (code == InternalPrimitiveTypeE.Invalid)
            {
                if (objectInfo != null)
                {
                    nameInfo.NIname = objectInfo.GetTypeFullName();
                    nameInfo.NIassemId = objectInfo.assemId;                    
                }
            }
            nameInfo.NIprimitiveTypeEnum = code; 
            nameInfo.NItype = type;

            SerTrace.Log( this, "TypeToNameInfo Exit ",type, " typeName "+nameInfo.NIname);
            return nameInfo;            
        }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:23,代碼來源:BinaryObjectWriter.cs

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

示例5: GetNameSpaceEnum

        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;
        } 
開發者ID:sjyanxin,項目名稱:WPFSource,代碼行數:63,代碼來源:BinaryConverter.cs

示例6: 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)
        {
            BinaryTypeEnum binaryTypeEnum;

            assemId = 0;
            typeInformation = null;

            if (ReferenceEquals(type, Converter.s_typeofString))
            {
                binaryTypeEnum = BinaryTypeEnum.String;
            }
            else if (((objectInfo == null) || ((objectInfo != null) && !objectInfo._isSi)) && (ReferenceEquals(type, Converter.s_typeofObject)))
            {
                // If objectInfo.Si then can be a surrogate which will change the type
                binaryTypeEnum = BinaryTypeEnum.Object;
            }
            else if (ReferenceEquals(type, Converter.s_typeofStringArray))
            {
                binaryTypeEnum = BinaryTypeEnum.StringArray;
            }
            else if (ReferenceEquals(type, Converter.s_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.s_urtAssemblyString))
                        {
                            binaryTypeEnum = BinaryTypeEnum.ObjectUrt;
                            assemId = 0;
                        }
                        else
                        {
                            binaryTypeEnum = BinaryTypeEnum.ObjectUser;
                            Debug.Assert(objectInfo != null, "[BinaryConverter.GetBinaryTypeInfo]objectInfo null for user object");
                            assemId = (int)objectInfo._assemId;
                            if (assemId == 0)
                            {
                                throw new SerializationException(SR.Format(SR.Serialization_AssemblyId, typeInformation));
                            }
                        }
                        break;
                    default:
                        binaryTypeEnum = BinaryTypeEnum.Primitive;
                        typeInformation = primitiveTypeEnum;
                        break;
                }
            }

            return binaryTypeEnum;
        }
開發者ID:dotnet,項目名稱:corefx,代碼行數:72,代碼來源:BinaryTypeConverter.cs

示例7: Write

        // Writes a given object to the stream.
        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 (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 (objectInfo.objectType != Converter.typeofString)
                {
                    String objectName = objectInfo.GetTypeFullName();
                    serWriter.WriteObjectEnd(typeNameInfo, typeNameInfo);                       
                }
            }

            SerTrace.Log( this, "Write 2 Exit");
        }
開發者ID:ArildF,項目名稱:masters,代碼行數:73,代碼來源:binaryobjectwriter.cs

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

                if ((assemblyString != null) && (formatterEnums.FEassemblyFormat == FormatterAssemblyStyle.Simple))
                {
                    // Use only the simple assembly name (not version or strong name)
                    int index = assemblyString.IndexOf(',');
                    if (index > 0)
                        serializedAssemblyString = assemblyString.Substring(0, index);
                }
                serWriter.WriteAssembly(objectInfo.GetTypeFullName(), objectInfo.objectType, serializedAssemblyString, (int)assemId, isNew, false);
            }

            SerTrace.Log( this, "GetAssemblyId Exit id ",assemId," isNew ",isNew," assemblyString ",serializedAssemblyString);
            return assemId;
        }
開發者ID:ArildF,項目名稱:masters,代碼行數:53,代碼來源:binaryobjectwriter.cs

示例9: TypeToNameInfo

        // Transforms a type to the serialized string form. URT Primitive types are converted to XMLData Types
        private NameInfo TypeToNameInfo(Type type, WriteObjectInfo objectInfo, InternalPrimitiveTypeE code, NameInfo nameInfo)
        {
            if (nameInfo == null)
            {
                nameInfo = GetNameInfo();
            }
            else
            {
                nameInfo.Init();
            }

            if (code == InternalPrimitiveTypeE.Invalid)
            {
                if (objectInfo != null)
                {
                    nameInfo.NIname = objectInfo.GetTypeFullName();
                    nameInfo._assemId = objectInfo._assemId;
                }
            }
            nameInfo._primitiveTypeEnum = code;
            nameInfo._type = type;

            return nameInfo;
        }
開發者ID:Corillian,項目名稱:corefx,代碼行數:25,代碼來源:BinaryObjectWriter.cs

示例10: GetNameSpaceEnum

        internal static InternalNameSpaceE GetNameSpaceEnum(InternalPrimitiveTypeE code, Type type, WriteObjectInfo objectInfo, out string typeName)
        {
            InternalNameSpaceE none = InternalNameSpaceE.None;
            typeName = null;
            switch (code)
            {
                case InternalPrimitiveTypeE.Boolean:
                case InternalPrimitiveTypeE.Byte:
                case InternalPrimitiveTypeE.Char:
                case InternalPrimitiveTypeE.Double:
                case InternalPrimitiveTypeE.Int16:
                case InternalPrimitiveTypeE.Int32:
                case InternalPrimitiveTypeE.Int64:
                case InternalPrimitiveTypeE.SByte:
                case InternalPrimitiveTypeE.Single:
                case InternalPrimitiveTypeE.TimeSpan:
                case InternalPrimitiveTypeE.DateTime:
                case InternalPrimitiveTypeE.UInt16:
                case InternalPrimitiveTypeE.UInt32:
                case InternalPrimitiveTypeE.UInt64:
                    none = InternalNameSpaceE.XdrPrimitive;
                    typeName = "System." + ToComType(code);
                    break;

                case InternalPrimitiveTypeE.Decimal:
                    none = InternalNameSpaceE.UrtSystem;
                    typeName = "System." + ToComType(code);
                    break;
            }
            if ((none != InternalNameSpaceE.None) || (type == null))
            {
                return none;
            }
            if (object.ReferenceEquals(type, typeofString))
            {
                return InternalNameSpaceE.XdrString;
            }
            if (objectInfo == null)
            {
                typeName = type.FullName;
                if (type.Assembly == urtAssembly)
                {
                    return InternalNameSpaceE.UrtSystem;
                }
                return InternalNameSpaceE.UrtUser;
            }
            typeName = objectInfo.GetTypeFullName();
            if (objectInfo.GetAssemblyString().Equals(urtAssemblyString))
            {
                return InternalNameSpaceE.UrtSystem;
            }
            return InternalNameSpaceE.UrtUser;
        }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:53,代碼來源:Converter.cs


注:本文中的System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.GetTypeFullName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。