GetTypeFullName() private method

private GetTypeFullName ( ) : String
return String
示例#1
0
        private long GetAssemblyId(WriteObjectInfo objectInfo)
        {
            //use objectInfo to get assembly string with new criteria
            InternalST.Soap( this, "GetAssemblyId Entry ",objectInfo.objectType," isSi ",objectInfo.isSi);
            long assemId = 0;
            bool isNew = false;
            String assemblyString = objectInfo.GetAssemblyString();
            String serializedAssemblyString = assemblyString;
            if (assemblyString.Length == 0)
            {
                // Fake type could returns an empty string
                assemId = 0;
            }
            else if (assemblyString.Equals(Converter.urtAssemblyString))
            {
                // Urt type is an assemId of 0. No assemblyString needs
                // to be sent but for soap, dotted names need to be placed in header
                InternalST.Soap( this, "GetAssemblyId urt Assembly String ");
                assemId = 0;
                isNew = false;
                serWriter.WriteAssembly(objectInfo.GetTypeFullName(), objectInfo.objectType, null, (int)assemId, isNew, objectInfo.IsAttributeNameSpace());
            }
            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 = m_idGenerator.GetId("___AssemblyString___"+assemblyString, out isNew);
                    assemblyToIdTable[assemblyString] = assemId;
                }

                if (assemblyString != null && !objectInfo.IsInteropNameSpace())
                {
                    if (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, objectInfo.IsInteropNameSpace());
            }
            InternalST.Soap( this, "GetAssemblyId Exit id ",assemId," isNew ",isNew," assemblyString ",serializedAssemblyString);
            return assemId;
        }
示例#2
0
        // Writes a given object to the stream.
        private void Write(WriteObjectInfo objectInfo,         
                           NameInfo memberNameInfo,          
                           NameInfo typeNameInfo,            
                           String[] memberNames,             
                           Type[] memberTypes,               
                           Object[] memberData,              
                           WriteObjectInfo[] memberObjectInfos)
        {
            InternalST.Soap( this, "Write 2 Entry obj ",objectInfo.obj,". objectId ",objectInfo.objectId,", objType ",typeNameInfo.NIname,", memberName ",memberNameInfo.NIname,", memberType ",typeNameInfo.NIname,", isMustUnderstand ",memberNameInfo.NIisMustUnderstand);

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

            // Process members which will be written out as Soap attributes first
            if (objectInfo.cache.memberAttributeInfos != null)
            {
                InternalST.Soap( this, "Write Attribute Members");
                for (int i=0; i<objectInfo.cache.memberAttributeInfos.Length; i++)
                {
                    InternalST.Soap( this, "Write Attribute Members name ", memberNames[i]);                    
                    if ((objectInfo.cache.memberAttributeInfos[i] != null) &&
                        (objectInfo.cache.memberAttributeInfos[i].IsXmlAttribute()))
                        WriteMemberSetup(objectInfo, memberNameInfo, typeNameInfo, memberNames[i], memberTypes[i], memberData[i], memberObjectInfos[i], true);
                }
            }


            if (memberNameInfo != null)
            {
                InternalST.Soap( 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))
            {
                InternalST.Soap( 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)
                {
                    InternalST.Soap( 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++)
            {
                if ((objectInfo.cache.memberAttributeInfos == null) ||
                    (objectInfo.cache.memberAttributeInfos[i] == null) ||
                    (!(objectInfo.cache.memberAttributeInfos[i].IsXmlAttribute())))
                    WriteMemberSetup(objectInfo, memberNameInfo, typeNameInfo, memberNames[i], memberTypes[i], memberData[i], memberObjectInfos[i], false);
            }

            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);                       
                }
            }

            InternalST.Soap( this, "Write 2 Exit");
        }
 internal static InternalNameSpaceE GetNameSpaceEnum(InternalPrimitiveTypeE code, Type type, WriteObjectInfo objectInfo, out string typeName)
 {
     InternalNameSpaceE none = InternalNameSpaceE.None;
     typeName = null;
     if (code != InternalPrimitiveTypeE.Invalid)
     {
         if (code == InternalPrimitiveTypeE.Char)
         {
             none = InternalNameSpaceE.UrtSystem;
             typeName = "System.Char";
         }
         else
         {
             none = InternalNameSpaceE.XdrPrimitive;
             typeName = ToXmlDataType(code);
         }
     }
     if ((none == InternalNameSpaceE.None) && (type != null))
     {
         if (type == typeofString)
         {
             none = InternalNameSpaceE.XdrString;
         }
         else if (objectInfo == null)
         {
             typeName = type.FullName;
             if (type.Module.Assembly == urtAssembly)
             {
                 none = InternalNameSpaceE.UrtSystem;
             }
             else
             {
                 none = InternalNameSpaceE.UrtUser;
             }
         }
         else
         {
             typeName = objectInfo.GetTypeFullName();
             if (objectInfo.GetAssemblyString().Equals(urtAssemblyString))
             {
                 none = InternalNameSpaceE.UrtSystem;
             }
             else
             {
                 none = InternalNameSpaceE.UrtUser;
             }
         }
     }
     if (objectInfo != null)
     {
         if (!objectInfo.isSi && ((objectInfo.IsAttributeNameSpace() || objectInfo.IsCustomXmlAttribute()) || objectInfo.IsCustomXmlElement()))
         {
             return InternalNameSpaceE.Interop;
         }
         if (objectInfo.IsCallElement())
         {
             none = InternalNameSpaceE.CallElement;
         }
     }
     return none;
 }
 private void Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo, string[] memberNames, Type[] memberTypes, object[] memberData, WriteObjectInfo[] memberObjectInfos)
 {
     int length = memberNames.Length;
     NameInfo nameInfo = null;
     if (objectInfo.cache.memberAttributeInfos != null)
     {
         for (int j = 0; j < objectInfo.cache.memberAttributeInfos.Length; j++)
         {
             if ((objectInfo.cache.memberAttributeInfos[j] != null) && objectInfo.cache.memberAttributeInfos[j].IsXmlAttribute())
             {
                 this.WriteMemberSetup(objectInfo, memberNameInfo, typeNameInfo, memberNames[j], memberTypes[j], memberData[j], memberObjectInfos[j], true);
             }
         }
     }
     if (memberNameInfo != null)
     {
         memberNameInfo.NIobjectId = objectInfo.objectId;
         this.serWriter.WriteObject(memberNameInfo, typeNameInfo, length, memberNames, memberTypes, memberObjectInfos);
     }
     else if ((objectInfo.objectId == this.topId) && (this.topName != null))
     {
         nameInfo = this.MemberToNameInfo(this.topName);
         nameInfo.NIobjectId = objectInfo.objectId;
         this.serWriter.WriteObject(nameInfo, typeNameInfo, length, memberNames, memberTypes, memberObjectInfos);
     }
     else if (objectInfo.objectType != Converter.typeofString)
     {
         typeNameInfo.NIobjectId = objectInfo.objectId;
         this.serWriter.WriteObject(typeNameInfo, null, length, memberNames, memberTypes, memberObjectInfos);
     }
     if (memberNameInfo.NIisParentTypeOnObject)
     {
         memberNameInfo.NItransmitTypeOnObject = true;
         memberNameInfo.NIisParentTypeOnObject = false;
     }
     else
     {
         memberNameInfo.NItransmitTypeOnObject = false;
     }
     for (int i = 0; i < length; i++)
     {
         if (((objectInfo.cache.memberAttributeInfos == null) || (objectInfo.cache.memberAttributeInfos[i] == null)) || !objectInfo.cache.memberAttributeInfos[i].IsXmlAttribute())
         {
             this.WriteMemberSetup(objectInfo, memberNameInfo, typeNameInfo, memberNames[i], memberTypes[i], memberData[i], memberObjectInfos[i], false);
         }
     }
     if (memberNameInfo != null)
     {
         memberNameInfo.NIobjectId = objectInfo.objectId;
         this.serWriter.WriteObjectEnd(memberNameInfo, typeNameInfo);
     }
     else if ((objectInfo.objectId == this.topId) && (this.topName != null))
     {
         this.serWriter.WriteObjectEnd(nameInfo, typeNameInfo);
         this.PutNameInfo(nameInfo);
     }
     else if (objectInfo.objectType != Converter.typeofString)
     {
         objectInfo.GetTypeFullName();
         this.serWriter.WriteObjectEnd(typeNameInfo, typeNameInfo);
     }
 }
 private long GetAssemblyId(WriteObjectInfo objectInfo)
 {
     long id = 0L;
     bool isNew = false;
     string assemblyString = objectInfo.GetAssemblyString();
     string assemName = assemblyString;
     if (assemblyString.Length == 0)
     {
         return 0L;
     }
     if (assemblyString.Equals(Converter.urtAssemblyString))
     {
         id = 0L;
         isNew = false;
         this.serWriter.WriteAssembly(objectInfo.GetTypeFullName(), objectInfo.objectType, null, (int) id, isNew, objectInfo.IsAttributeNameSpace());
         return id;
     }
     if (this.assemblyToIdTable.ContainsKey(assemblyString))
     {
         id = (long) this.assemblyToIdTable[assemblyString];
         isNew = false;
     }
     else
     {
         id = this.m_idGenerator.GetId("___AssemblyString___" + assemblyString, out isNew);
         this.assemblyToIdTable[assemblyString] = id;
     }
     if (((assemblyString != null) && !objectInfo.IsInteropNameSpace()) && (this.formatterEnums.FEassemblyFormat == FormatterAssemblyStyle.Simple))
     {
         int index = assemblyString.IndexOf(',');
         if (index > 0)
         {
             assemName = assemblyString.Substring(0, index);
         }
     }
     this.serWriter.WriteAssembly(objectInfo.GetTypeFullName(), objectInfo.objectType, assemName, (int) id, isNew, objectInfo.IsInteropNameSpace());
     return id;
 }
        internal static InternalNameSpaceE GetNameSpaceEnum(InternalPrimitiveTypeE code, Type type, WriteObjectInfo objectInfo, out String typeName)
        {
            InternalST.Soap("Converter", "GetNameSpaceEnum Entry ",((Enum)code).ToString()," type ",type);                  
            InternalNameSpaceE nameSpaceEnum = InternalNameSpaceE.None;
            typeName = null;

            if (code != InternalPrimitiveTypeE.Invalid)
            {

                if (code == InternalPrimitiveTypeE.Char)
                {
                    nameSpaceEnum = InternalNameSpaceE.UrtSystem;
                    typeName = "System.Char";
                }
                else
                {
                    nameSpaceEnum = InternalNameSpaceE.XdrPrimitive;
                    typeName = ToXmlDataType(code);
                }
            }

            if ((nameSpaceEnum == InternalNameSpaceE.None) && (type != null))
            {
                if (type == typeofString)
                    nameSpaceEnum = InternalNameSpaceE.XdrString;
                else
                {
                    if (objectInfo == null)
                    {
                        typeName = type.FullName;
                        if (type.Module.Assembly == urtAssembly)
                            nameSpaceEnum = InternalNameSpaceE.UrtSystem;
                        else
                            nameSpaceEnum = InternalNameSpaceE.UrtUser;                     
                    }
                    else
                    {
                        typeName = objectInfo.GetTypeFullName();
                        // If objref is created from a proxy, it will have the proxy namespace
                        // Need to force ObjRef to have system namespace
                        if (objectInfo.GetAssemblyString().Equals(urtAssemblyString))
                            nameSpaceEnum = InternalNameSpaceE.UrtSystem;
                        else
                            nameSpaceEnum = InternalNameSpaceE.UrtUser;
                    }
                }
            }

            // If there is an explicitly specified namespace, then it is used
            if (objectInfo != null)
            {
                if (!objectInfo.isSi &&
                    (objectInfo.IsAttributeNameSpace() ||
                    objectInfo.IsCustomXmlAttribute() ||
                    objectInfo.IsCustomXmlElement()))
                {
                    nameSpaceEnum = InternalNameSpaceE.Interop;
                }
                else if (objectInfo.IsCallElement())
                {
                    nameSpaceEnum = InternalNameSpaceE.CallElement;
                }
            }

            InternalST.Soap("Converter", "GetNameSpaceEnum Exit ", ((Enum)nameSpaceEnum).ToString()," typeName ",typeName);                             
            return nameSpaceEnum;
        }
        internal static InternalNameSpaceE GetNameSpaceEnum(InternalPrimitiveTypeE code, Type type, WriteObjectInfo objectInfo, out string typeName)
        {
            InternalNameSpaceE none = InternalNameSpaceE.None;

            typeName = null;
            if (code != InternalPrimitiveTypeE.Invalid)
            {
                if (code == InternalPrimitiveTypeE.Char)
                {
                    none     = InternalNameSpaceE.UrtSystem;
                    typeName = "System.Char";
                }
                else
                {
                    none     = InternalNameSpaceE.XdrPrimitive;
                    typeName = ToXmlDataType(code);
                }
            }
            if ((none == InternalNameSpaceE.None) && (type != null))
            {
                if (type == typeofString)
                {
                    none = InternalNameSpaceE.XdrString;
                }
                else if (objectInfo == null)
                {
                    typeName = type.FullName;
                    if (type.Module.Assembly == urtAssembly)
                    {
                        none = InternalNameSpaceE.UrtSystem;
                    }
                    else
                    {
                        none = InternalNameSpaceE.UrtUser;
                    }
                }
                else
                {
                    typeName = objectInfo.GetTypeFullName();
                    if (objectInfo.GetAssemblyString().Equals(urtAssemblyString))
                    {
                        none = InternalNameSpaceE.UrtSystem;
                    }
                    else
                    {
                        none = InternalNameSpaceE.UrtUser;
                    }
                }
            }
            if (objectInfo != null)
            {
                if (!objectInfo.isSi && ((objectInfo.IsAttributeNameSpace() || objectInfo.IsCustomXmlAttribute()) || objectInfo.IsCustomXmlElement()))
                {
                    return(InternalNameSpaceE.Interop);
                }
                if (objectInfo.IsCallElement())
                {
                    none = InternalNameSpaceE.CallElement;
                }
            }
            return(none);
        }