예제 #1
0
        private DottedInfo ParseAssemblyName(string typeFullName, string assemName)
        {
            string typeNamespace = null;
            string str2          = null;
            string key           = null;
            int    num;

            if (this.typeNameToDottedInfoTable.ContainsKey(typeFullName))
            {
                return((DottedInfo)this.typeNameToDottedInfoTable[typeFullName]);
            }
            int length = typeFullName.LastIndexOf('.');

            if (length > 0)
            {
                typeNamespace = typeFullName.Substring(0, length);
            }
            else
            {
                typeNamespace = "";
            }
            key  = SoapServices.CodeXmlNamespaceForClrTypeNamespace(typeNamespace, assemName);
            str2 = typeFullName.Substring(length + 1);
            if (this.dottedAssemToAssemIdTable.ContainsKey(key))
            {
                num = (int)this.dottedAssemToAssemIdTable[key];
            }
            else
            {
                num = this.dottedAssemId++;
                this.assemblyInfos[this.AssemIdToString(num)] = new AssemblyInfo(num, key, false);
                this.dottedAssemToAssemIdTable[key]           = num;
            }
            DottedInfo info = new DottedInfo {
                dottedAssemblyName = key,
                name      = str2,
                nameSpace = typeNamespace,
                assemId   = num
            };

            this.typeNameToDottedInfoTable[typeFullName] = info;
            return(info);
        }
 private DottedInfo ParseAssemblyName(string typeFullName, string assemName)
 {
     string typeNamespace = null;
     string str2 = null;
     string key = null;
     int num;
     if (this.typeNameToDottedInfoTable.ContainsKey(typeFullName))
     {
         return (DottedInfo) this.typeNameToDottedInfoTable[typeFullName];
     }
     int length = typeFullName.LastIndexOf('.');
     if (length > 0)
     {
         typeNamespace = typeFullName.Substring(0, length);
     }
     else
     {
         typeNamespace = "";
     }
     key = SoapServices.CodeXmlNamespaceForClrTypeNamespace(typeNamespace, assemName);
     str2 = typeFullName.Substring(length + 1);
     if (this.dottedAssemToAssemIdTable.ContainsKey(key))
     {
         num = (int) this.dottedAssemToAssemIdTable[key];
     }
     else
     {
         num = this.dottedAssemId++;
         this.assemblyInfos[this.AssemIdToString(num)] = new AssemblyInfo(num, key, false);
         this.dottedAssemToAssemIdTable[key] = num;
     }
     DottedInfo info = new DottedInfo {
         dottedAssemblyName = key,
         name = str2,
         nameSpace = typeNamespace,
         assemId = num
     };
     this.typeNameToDottedInfoTable[typeFullName] = info;
     return info;
 }
예제 #3
0
        private string NameTagResolver(NameInfo typeNameInfo, bool isXsiAppended, string arrayItemName)
        {
            string nIname = typeNameInfo.NIname;

            switch (typeNameInfo.NInameSpaceEnum)
            {
            case InternalNameSpaceE.None:
            case InternalNameSpaceE.UserNameSpace:
            case InternalNameSpaceE.MemberName:
                return(nIname);

            case InternalNameSpaceE.Soap:
                nIname         = "SOAP-ENC:" + typeNameInfo.NIname;
                this.isUsedEnc = true;
                return(nIname);

            case InternalNameSpaceE.XdrPrimitive:
                if (isXsiAppended)
                {
                    nIname = "xsd:" + typeNameInfo.NIname;
                }
                return(nIname);

            case InternalNameSpaceE.XdrString:
                if (isXsiAppended)
                {
                    nIname = "xsd:" + typeNameInfo.NIname;
                }
                return(nIname);

            case InternalNameSpaceE.UrtSystem:
                if (!(typeNameInfo.NItype == SoapUtil.typeofObject))
                {
                    DottedInfo info3;
                    if (arrayItemName == null)
                    {
                        DottedInfo info;
                        if (this.typeNameToDottedInfoTable.ContainsKey(typeNameInfo.NIname))
                        {
                            info = (DottedInfo)this.typeNameToDottedInfoTable[typeNameInfo.NIname];
                        }
                        else
                        {
                            info = this.ParseAssemblyName(typeNameInfo.NIname, null);
                        }
                        string str2 = this.AssemIdToString(info.assemId);
                        nIname = str2 + ":" + info.name;
                        AssemblyInfo info2 = (AssemblyInfo)this.assemblyInfos[str2];
                        info2.isUsed = true;
                        info2.prefix = str2;
                        this.assemblyInfoUsed[info2] = 1;
                        return(nIname);
                    }
                    if (this.typeNameToDottedInfoTable.ContainsKey(arrayItemName))
                    {
                        info3 = (DottedInfo)this.typeNameToDottedInfoTable[arrayItemName];
                    }
                    else
                    {
                        info3 = this.ParseAssemblyName(arrayItemName, null);
                    }
                    string str3 = this.AssemIdToString(info3.assemId);
                    nIname = str3 + ":" + this.DottedDimensionName(info3.name, typeNameInfo.NIname);
                    AssemblyInfo info4 = (AssemblyInfo)this.assemblyInfos[str3];
                    info4.isUsed = true;
                    info4.prefix = str3;
                    this.assemblyInfoUsed[info4] = 1;
                    return(nIname);
                }
                return("xsd:anyType");

            case InternalNameSpaceE.UrtUser:
                if (typeNameInfo.NIassemId > 0L)
                {
                    if (arrayItemName != null)
                    {
                        if (!this.typeNameToDottedInfoTable.ContainsKey(arrayItemName))
                        {
                            throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_Assembly"), new object[] { typeNameInfo.NIname }));
                        }
                        DottedInfo info7 = (DottedInfo)this.typeNameToDottedInfoTable[arrayItemName];
                        string     str5  = this.AssemIdToString(info7.assemId);
                        nIname = str5 + ":" + this.DottedDimensionName(info7.name, typeNameInfo.NIname);
                        AssemblyInfo info8 = (AssemblyInfo)this.assemblyInfos[str5];
                        info8.isUsed = true;
                        info8.prefix = str5;
                        this.assemblyInfoUsed[info8] = 1;
                        return(nIname);
                    }
                    if (!this.typeNameToDottedInfoTable.ContainsKey(typeNameInfo.NIname))
                    {
                        throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_Assembly"), new object[] { typeNameInfo.NIname }));
                    }
                    DottedInfo info5 = (DottedInfo)this.typeNameToDottedInfoTable[typeNameInfo.NIname];
                    string     str4  = this.AssemIdToString(info5.assemId);
                    nIname = str4 + ":" + info5.name;
                    AssemblyInfo info6 = (AssemblyInfo)this.assemblyInfos[str4];
                    info6.isUsed = true;
                    info6.prefix = str4;
                    this.assemblyInfoUsed[info6] = 1;
                }
                return(nIname);

            case InternalNameSpaceE.Interop:
                if ((typeNameInfo.NIattributeInfo != null) && (typeNameInfo.NIattributeInfo.AttributeElementName != null))
                {
                    if (typeNameInfo.NIassemId <= 0L)
                    {
                        return(typeNameInfo.NIattributeInfo.AttributeElementName);
                    }
                    string str7 = this.InteropAssemIdToString((int)typeNameInfo.NIassemId);
                    nIname = str7 + ":" + typeNameInfo.NIattributeInfo.AttributeElementName;
                    if (arrayItemName != null)
                    {
                        int index = typeNameInfo.NIname.IndexOf("[");
                        nIname = nIname + typeNameInfo.NIname.Substring(index);
                    }
                    AssemblyInfo info10 = (AssemblyInfo)this.assemblyInfos[str7];
                    info10.isUsed = true;
                    info10.prefix = str7;
                    this.assemblyInfoUsed[info10] = 1;
                }
                return(nIname);

            case InternalNameSpaceE.CallElement:
                if (typeNameInfo.NIassemId > 0L)
                {
                    string       str6  = this.InteropAssemIdToString((int)typeNameInfo.NIassemId);
                    AssemblyInfo info9 = (AssemblyInfo)this.assemblyInfos[str6];
                    if (info9 == null)
                    {
                        throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_NameSpaceEnum"), new object[] { typeNameInfo.NInameSpaceEnum }));
                    }
                    nIname       = str6 + ":" + typeNameInfo.NIname;
                    info9.isUsed = true;
                    info9.prefix = str6;
                    this.assemblyInfoUsed[info9] = 1;
                    return(nIname);
                }
                return(nIname);
            }
            throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_NameSpaceEnum"), new object[] { typeNameInfo.NInameSpaceEnum }));
        }
예제 #4
0
		private DottedInfo ParseAssemblyName(String typeFullName, String assemName)
		{
			InternalST.Soap( this, "ParseAssemblyName Entry typeFullName ",typeFullName," assemName ",assemName);
			DottedInfo dottedInfo;
			String nameSpace = null;
			String name = null;
			String dottedAssemblyName = null;
			int assemId;
			if (typeNameToDottedInfoTable.ContainsKey(typeFullName))
			{
				// type name already seen 
				dottedInfo = (DottedInfo)typeNameToDottedInfoTable[typeFullName];
			}
			else
			{
				// type name new, find nameSpace and concatenate the assembly name to it.
				int index = typeFullName.LastIndexOf('.');
				if (index > 0)
					nameSpace = typeFullName.Substring(0, index);
				else
					nameSpace = "";


                dottedAssemblyName = SoapServices.CodeXmlNamespaceForClrTypeNamespace(nameSpace, assemName);

				name = typeFullName.Substring(index+1);				

				if (dottedAssemToAssemIdTable.ContainsKey(dottedAssemblyName))
				{
					// The dotted assembly name has been seen before, get the assembly Id
					assemId = (int)dottedAssemToAssemIdTable[dottedAssemblyName];
				}
				else
				{
					// The dotted assembly name has not been seen before, calculate a new
					// assemId and remember it so that it can be added to the Envelope xml namespaces
					assemId = dottedAssemId++;
					assemblyInfos[AssemIdToString(assemId)] = new AssemblyInfo(assemId, dottedAssemblyName, false);
					dottedAssemToAssemIdTable[dottedAssemblyName] = assemId;
				}

				// Create a new DottedInfo structure and remember it with the type name
				dottedInfo = new DottedInfo();
				dottedInfo.dottedAssemblyName = dottedAssemblyName;
				dottedInfo.name = name;
				dottedInfo.nameSpace = nameSpace;
				dottedInfo.assemId = assemId;
				typeNameToDottedInfoTable[typeFullName] = dottedInfo;			
				InternalST.Soap( this, "ParseAssemblyName new dotted Assembly name ",dottedInfo.name,", dottedAssemblyName ",dottedInfo.dottedAssemblyName,", assemId ",dottedInfo.assemId, " typeFullName ", typeFullName);
			}
			InternalST.Soap( this, "ParseAssemblyName Exit nameSpace ",dottedInfo.nameSpace," name ",dottedInfo.name," assemblyName ",dottedInfo.dottedAssemblyName," assemId ",dottedInfo.assemId);
			return dottedInfo;
		}