/// <summary> /// Initializes a new instance of the <see cref="FilterBuilderCollection"/> class /// with the specified array of <see cref="FilterBuilder"/> instances. /// </summary> public FilterBuilderCollection(FilterBuilder[] value) { AddRange(value); }
/// <summary> /// Scans a given <see cref="Type" /> for filters. /// </summary> /// <param name="extensionAssembly">The <see cref="ExtensionAssembly" /> containing the <see cref="Type" /> to scan.</param> /// <param name="type">The <see cref="Type" /> to scan.</param> /// <param name="task">The <see cref="Task" /> which will be used to output messages to the build log.</param> /// <returns> /// <see langword="true" /> if <paramref name="type" /> represents a /// <see cref="Filter" />; otherwise, <see langword="false" />. /// </returns> private static bool ScanTypeForFilters(ExtensionAssembly extensionAssembly, Type type, Task task) { try { ElementNameAttribute elementNameAttribute = (ElementNameAttribute) Attribute.GetCustomAttribute(type, typeof(ElementNameAttribute)); if (type.IsSubclassOf(typeof(Filter)) && !type.IsAbstract && elementNameAttribute != null) { task.Log(Level.Debug, "Creating FilterBuilder for \"{0}\".", type.Name); FilterBuilder builder = new FilterBuilder(extensionAssembly, type.FullName); if (FilterBuilders[builder.FilterName] == null) { FilterBuilders.Add(builder); task.Log(Level.Debug, "Adding filter \"{0}\" from {1}:{2}.", builder.FilterName, GetAssemblyLocation(builder.Assembly), builder.ClassName); } // specified type represents a filter return true; } // specified type does not represent a valid filter return false; } catch { task.Log(Level.Error, "Failure scanning \"{0}\" for filters.", type.AssemblyQualifiedName); throw; } }
/// <summary> /// Inserts a <see cref="FilterBuilder"/> into the collection at the specified index. /// </summary> /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param> /// <param name="item">The <see cref="FilterBuilder"/> to insert.</param> public void Insert(int index, FilterBuilder item) { base.List.Insert(index, item); }
/// <summary> /// Removes a member from the collection. /// </summary> /// <param name="item">The <see cref="FilterBuilder"/> to remove from the collection.</param> public void Remove(FilterBuilder item) { base.List.Remove(item); }
/// <summary> /// Retrieves the index of a specified <see cref="FilterBuilder"/> object in the collection. /// </summary> /// <param name="item">The <see cref="FilterBuilder"/> object for which the index is returned.</param> /// <returns> /// The index of the specified <see cref="FilterBuilder"/>. If the <see cref="FilterBuilder"/> is not currently a member of the collection, it returns -1. /// </returns> public int IndexOf(FilterBuilder item) { return base.List.IndexOf(item); }
/// <summary> /// Copies the entire collection to a compatible one-dimensional array, starting at the specified index of the target array. /// </summary> /// <param name="array">The one-dimensional array that is the destination of the elements copied from the collection. The array must have zero-based indexing.</param> /// <param name="index">The zero-based index in <paramref name="array"/> at which copying begins.</param> public void CopyTo(FilterBuilder[] array, int index) { base.List.CopyTo(array, index); }
/// <summary> /// Determines whether a <see cref="FilterBuilder"/> is in the collection. /// </summary> /// <param name="item">The <see cref="FilterBuilder"/> to locate in the collection.</param> /// <returns> /// <see langword="true" /> if <paramref name="item"/> is found in the /// collection; otherwise, <see langword="false" />. /// </returns> public bool Contains(FilterBuilder item) { return base.List.Contains(item); }
/// <summary> /// Adds the elements of a <see cref="FilterBuilder"/> array to the end of the collection. /// </summary> /// <param name="items">The array of <see cref="FilterBuilder"/> elements to be added to the end of the collection.</param> public void AddRange(FilterBuilder[] items) { for (int i = 0; (i < items.Length); i = (i + 1)) { Add(items[i]); } }
/// <summary> /// Adds a <see cref="FilterBuilder"/> to the end of the collection. /// </summary> /// <param name="item">The <see cref="FilterBuilder"/> to be added to the end of the collection.</param> /// <returns>The position into which the new element was inserted.</returns> public int Add(FilterBuilder item) { return base.List.Add(item); }