public int Add(string name, Type type)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (!type.IsSubclassOf(typeof(SchemaImporterExtension)))
            {
                throw new ArgumentException("The type argument must be subclass of SchemaImporterExtension.");
            }

            SchemaImporterExtension e = (SchemaImporterExtension)Activator.CreateInstance(type);

            if (named_items.ContainsKey(name))
            {
                throw new InvalidOperationException(String.Format("A SchemaImporterExtension keyed by '{0}' already exists.", name));
            }
            int ret = Add(e);

            named_items.Add(name, e);
            return(ret);
        }
 public void Insert(int index, SchemaImporterExtension extension)
 {
     if (extension == null)
     {
         throw new ArgumentNullException("extension");
     }
     List.Insert(index, extension);
 }
 public int Add(SchemaImporterExtension extension)
 {
     if (extension == null)
     {
         throw new ArgumentNullException("extension");
     }
     return(List.Add(extension));
 }
		public bool Contains (SchemaImporterExtension extension)
		{
			if (extension == null)
				throw new ArgumentNullException ("extension");
			foreach (SchemaImporterExtension e in List)
				if (extension.Equals (e))
					return true;
			return false;
		}
        public void Remove(SchemaImporterExtension extension)
        {
            int idx = IndexOf(extension);

            if (idx >= 0)
            {
                List.RemoveAt(idx);
            }
        }
Example #6
0
 internal MappedTypeDesc(string clrType, string name, string ns, XmlSchemaType xsdType, XmlSchemaObject context, SchemaImporterExtension extension, CodeNamespace code, StringCollection references)
 {
     this.clrType    = clrType.Replace('+', '.');
     this.name       = name;
     this.ns         = ns;
     this.xsdType    = xsdType;
     this.context    = context;
     this.code       = code;
     this.references = references;
     this.extension  = extension;
 }
 internal int Add(string name, SchemaImporterExtension extension)
 {
     if (this.Names[name] != null)
     {
         if (this.Names[name].GetType() != extension.GetType())
         {
             throw new InvalidOperationException(Res.GetString("XmlConfigurationDuplicateExtension", new object[] { name }));
         }
         return -1;
     }
     this.Names[name] = extension;
     return base.List.Add(extension);
 }
 internal int Add(string name, SchemaImporterExtension extension)
 {
     if (Names[name] != null)
     {
         if (Names[name].GetType() != extension.GetType())
         {
             throw new InvalidOperationException(Res.GetString(Res.XmlConfigurationDuplicateExtension, name));
         }
         return(-1);
     }
     Names[name] = extension;
     return(List.Add(extension));
 }
 internal int Add(string name, SchemaImporterExtension extension)
 {
     if (this.Names[name] != null)
     {
         if (this.Names[name].GetType() != extension.GetType())
         {
             throw new InvalidOperationException(Res.GetString("XmlConfigurationDuplicateExtension", new object[] { name }));
         }
         return(-1);
     }
     this.Names[name] = extension;
     return(base.List.Add(extension));
 }
 public bool Contains(SchemaImporterExtension extension)
 {
     if (extension == null)
     {
         throw new ArgumentNullException("extension");
     }
     foreach (SchemaImporterExtension e in List)
     {
         if (extension.Equals(e))
         {
             return(true);
         }
     }
     return(false);
 }
        public void Remove(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (!named_items.ContainsKey(name))
            {
                return;
            }
            SchemaImporterExtension e = named_items [name];

            Remove(e);
            named_items.Remove(name);
        }
        public int IndexOf(SchemaImporterExtension extension)
        {
            if (extension == null)
            {
                throw new ArgumentNullException("extension");
            }
            int i = 0;

            foreach (SchemaImporterExtension e in List)
            {
                if (extension.Equals(e))
                {
                    return(i);
                }
                i++;
            }
            return(-1);
        }
		public void CopyTo (SchemaImporterExtension [] array, int index)
		{
			List.CopyTo (array, index);
		}
 public int Add(SchemaImporterExtension extension)
 {
     return(Add(extension.GetType().FullName, extension));
 }
		public int Add (SchemaImporterExtension extension)
		{
			if (extension == null)
				throw new ArgumentNullException ("extension");
			return List.Add (extension);
		}
 internal int Add(string name, SchemaImporterExtension extension) {
     if (Names[name] != null) {
         if (Names[name].GetType() != extension.GetType()) {
             throw new InvalidOperationException(Res.GetString(Res.XmlConfigurationDuplicateExtension, name));
         }
         return -1;
     }
     Names[name] = extension;
     return List.Add(extension);
 }
 public void Insert(int index, SchemaImporterExtension extension)
 {
     List.Insert(index, extension);
 }
 public void Remove(SchemaImporterExtension extension)
 {
     List.Remove(extension);
 }
 public int IndexOf(SchemaImporterExtension extension)
 {
     return base.List.IndexOf(extension);
 }
 internal string FindExtendedAnyElement(XmlSchemaAny any, bool mixed, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, out SchemaImporterExtension extension)
 {
     extension = null;
     foreach (SchemaImporterExtension extension2 in base.Extensions)
     {
         string str = extension2.ImportAnyElement(any, mixed, base.Schemas, this, compileUnit, mainNamespace, base.Options, base.CodeProvider);
         if ((str != null) && (str.Length > 0))
         {
             extension = extension2;
             return str;
         }
     }
     return null;
 }
 internal string FindExtendedType(string name, string ns, XmlSchemaObject context, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, out SchemaImporterExtension extension)
 {
     extension = null;
     foreach (SchemaImporterExtension extension2 in base.Extensions)
     {
         string str = extension2.ImportSchemaType(name, ns, context, base.Schemas, this, compileUnit, mainNamespace, base.Options, base.CodeProvider);
         if ((str != null) && (str.Length > 0))
         {
             extension = extension2;
             return str;
         }
     }
     return null;
 }
 public int Add(SchemaImporterExtension extension)
 {
     return this.Add(extension.GetType().FullName, extension);
 }
Example #23
0
 internal string FindExtendedType(XmlSchemaType type, XmlSchemaObject context, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, out SchemaImporterExtension extension)
 {
     extension = null;
     foreach (SchemaImporterExtension ex in Extensions)
     {
         string typeName = ex.ImportSchemaType(type, context, Schemas, this, compileUnit, mainNamespace, Options, CodeProvider);
         if (typeName != null && typeName.Length > 0)
         {
             extension = ex;
             return typeName;
         }
     }
     return null;
 }
Example #24
0
 internal string FindExtendedAnyElement(XmlSchemaAny any, bool mixed, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, out SchemaImporterExtension extension)
 {
     extension = null;
     foreach (SchemaImporterExtension ex in Extensions)
     {
         string typeName = ex.ImportAnyElement(any, mixed, Schemas, this, compileUnit, mainNamespace, Options, CodeProvider);
         if (typeName != null && typeName.Length > 0)
         {
             extension = ex;
             return typeName;
         }
     }
     return null;
 }
		public int IndexOf (SchemaImporterExtension extension)
		{
			if (extension == null)
				throw new ArgumentNullException ("extension");
			int i = 0;
			foreach (SchemaImporterExtension e in List) {
				if (extension.Equals (e)) {
					return i;
				}
				i++;
			}
			return -1;
		}
 public void Insert(int index, SchemaImporterExtension extension)
 {
     base.List.Insert(index, extension);
 }
 public void Remove(SchemaImporterExtension extension)
 {
     base.List.Remove(extension);
 }
 public bool Contains(SchemaImporterExtension extension)
 {
     return(List.Contains(extension));
 }
		public void Insert (int index, SchemaImporterExtension extension)
		{
			if (extension == null)
				throw new ArgumentNullException ("extension");
			List.Insert (index, extension);
		}
 public int IndexOf(SchemaImporterExtension extension)
 {
     return(List.IndexOf(extension));
 }
		public void Remove (SchemaImporterExtension extension)
		{
			int idx = IndexOf (extension);
			if (idx >= 0)
				List.RemoveAt (idx);
		}
 public bool Contains(SchemaImporterExtension extension)
 {
     return base.List.Contains(extension);
 }
 internal MappedTypeDesc(string clrType, string name, string ns, XmlSchemaType xsdType, XmlSchemaObject context, SchemaImporterExtension extension, CodeNamespace code, StringCollection references) {
     this.clrType = clrType.Replace('+', '.');
     this.name = name;
     this.ns = ns;
     this.xsdType = xsdType;
     this.context = context;
     this.code = code;
     this.references = references;
     this.extension = extension;
 }