Beispiel #1
0
        public virtual IType GetType(IXmlNamespace xmlNamespace, string typeName)
        {
            string str;
            string str1;

            if (xmlNamespace == null)
            {
                throw new ArgumentNullException("xmlNamespace");
            }
            if (string.IsNullOrEmpty(typeName))
            {
                throw new ArgumentException(ExceptionStringTable.GetTypeCannotBeCalledWithNullOrEmptyTypeName, "typeName");
            }
            IType type = this.ProjectNamespaces.GetType(xmlNamespace, typeName);

            if (type != null)
            {
                return(type);
            }
            if (!XamlParser.TryParseClrNamespaceUri(xmlNamespace.Value, out str, out str1))
            {
                return(null);
            }
            return(this.GetType(str1, Microsoft.Expression.DesignModel.Metadata.TypeHelper.CombineNamespaceAndTypeName(str, typeName)));
        }
        public IType GetSampleType(IXmlNamespace xmlNamespace, string typeName)
        {
            if (this.dataSets.Count == 0)
            {
                return((IType)null);
            }
            string clrNamespace;
            string assemblyName;

            if (!XamlParser.TryParseClrNamespaceUri(xmlNamespace.Value, out clrNamespace, out assemblyName))
            {
                return((IType)null);
            }
            if (!clrNamespace.StartsWith(this.sampleDataClrNamespacePrefix, StringComparison.Ordinal) && !clrNamespace.StartsWith(this.dataStoreClrNamespacePrefix, StringComparison.Ordinal))
            {
                return((IType)null);
            }
            SampleDataSet sampleDataSet1 = this.GetSampleDataSet(clrNamespace.Substring(this.sampleDataClrNamespacePrefix.Length), true);

            if (sampleDataSet1 != null)
            {
                return(sampleDataSet1.GetSampleType(xmlNamespace, typeName));
            }
            SampleDataSet sampleDataSet2 = this.GetSampleDataSet(clrNamespace.Substring(this.dataStoreClrNamespacePrefix.Length), true);

            if (sampleDataSet2 != null)
            {
                return(sampleDataSet2.GetSampleType(xmlNamespace, typeName));
            }
            return((IType)null);
        }
 public bool GetNamespace(IXmlNamespace xmlNamespace, out AssemblyNamespace assemblyNamespace)
 {
     ClrNamespaceUriParseCache.ClrNamespaceDeclaration namespaceDeclaration;
     if (!this.dictionary.TryGetValue(xmlNamespace, out namespaceDeclaration))
     {
         string clrNamespace;
         string assemblyName;
         if (!XamlParser.TryParseClrNamespaceUri(xmlNamespace.Value, out clrNamespace, out assemblyName))
         {
             assemblyNamespace = (AssemblyNamespace)null;
             return(false);
         }
         namespaceDeclaration = new ClrNamespaceUriParseCache.ClrNamespaceDeclaration(this, assemblyName, clrNamespace);
         this.dictionary.Add(xmlNamespace, namespaceDeclaration);
     }
     assemblyNamespace = namespaceDeclaration.GetAssemblyNamespace();
     return(true);
 }
        public static bool IsErrorFromMissingAssembly(ITypeResolver typeResolver, XamlParseError parseError)
        {
            if (parseError.ErrorCode == 8 && parseError.Parameters.Count == 2)
            {
                string mapping      = parseError.Parameters[0];
                string clrNamespace = (string)null;
                string assemblyName = (string)null;
                if (XamlParser.TryParseClrNamespaceUri(mapping, out clrNamespace, out assemblyName))
                {
                    IAssembly assembly = assemblyName != null?typeResolver.GetAssembly(assemblyName) : typeResolver.ProjectAssembly;

                    if (assembly != null && !assembly.IsLoaded)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #5
0
 public static bool CrackXamlPrefixNamespaceBinding(string xmlns, out string clrNamespace, out string assemblyName)
 {
     return(XamlParser.TryParseClrNamespaceUri(xmlns, out clrNamespace, out assemblyName));
 }