GetAssemblyString() private method

private GetAssemblyString ( ) : String
return String
Beispiel #1
0
        internal String GetAssemblyString()
        {
            String assemblyString = null;

            InternalST.Soap(this, objectInfoId, " ", objectType, " GetAssemblyString Entry isSi ", isSi);

            if (arrayElemObjectInfo != null)
            {
                assemblyString = arrayElemObjectInfo.GetAssemblyString();
            }
            else if (IsAttributeNameSpace())
            {
                assemblyString = typeAttributeInfo.m_nameSpace;
            }
            else
            {
                assemblyString = cache.assemblyString;
            }

            InternalST.Soap(this, objectInfoId, " ", objectType, " GetAssemblyString Exit ", assemblyString);
            return(assemblyString);
        }
Beispiel #2
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;
        }
 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 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);
        }