Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public int Add(SchemaImporterExtension extension)
 {
     if (extension == null)
     {
         throw new ArgumentNullException("extension");
     }
     return(List.Add(extension));
 }
Exemplo n.º 3
0
 public void Insert(int index, SchemaImporterExtension extension)
 {
     if (extension == null)
     {
         throw new ArgumentNullException("extension");
     }
     List.Insert(index, extension);
 }
Exemplo n.º 4
0
        public void Remove(SchemaImporterExtension extension)
        {
            int idx = IndexOf(extension);

            if (idx >= 0)
            {
                List.RemoveAt(idx);
            }
        }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }