Пример #1
0
        public override bool Equals(object o)
        {
            XmlNsKey key = o as XmlNsKey;

            if (key == null)
            {
                return(false);
            }

            return(key.xmlns == this.xmlns && key.name == this.name);
        }
Пример #2
0
		private Type LoadTypeFromXmlNs (string xmlns, string name)
		{
			XmlNsKey key = new XmlNsKey (xmlns, name);
			Type t;
			
			if (Context.XmlnsCachedTypes.TryGetValue (key, out t))
				return t;

			t = FindType (xmlns, name);
			if (!IsValidType (t))
				t = null;
			
			Context.XmlnsCachedTypes.Add (key, t);
			return t;
		}
Пример #3
0
		public Type ResolveType (string xmlns, string full_name)
		{
			Log ("\t\tResolveType xmlns:{0} full_name:{1}", xmlns, full_name);

			Type t;
			var dictKey = new XmlNsKey (xmlns, full_name);
			if (Context.XmlnsCachedTypes.TryGetValue (dictKey, out t))
				return t;

			string ns = null;
			string asm_name = null;
			Assembly assembly = null;
			string name = full_name;
			int dot = name.IndexOf ('.');

			// We resolve attached property types with this function too
			// so make sure that we trim off the property part of the name
			if (dot > 0) {
				name = name.Substring (0, dot);
				full_name = name;
			}

			if (String.IsNullOrEmpty (xmlns))
				xmlns = reader.DefaultXmlns;

			ns = ResolveClrNamespace (xmlns);
			asm_name = ResolveAssemblyName (xmlns);
			if (ns != null)
				full_name = String.Concat (ns, ".", name);

			//
			// If no assembly is specified we pass in null and LoadType will search for the type
			//
			if (asm_name != null)
				assembly = LoadAssembly (asm_name);

			t = LoadType (assembly, xmlns, full_name);
			if (!Context.XmlnsCachedTypes.ContainsKey (dictKey))
				Context.XmlnsCachedTypes.Add (dictKey, t);
			return t;
		}