#region CPL License /* Nuclex.NAnt.Tasks Copyright (C) 2009 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #endregion using System; using System.Collections; using NAnt.Core.Types; namespace Nuclex.NAnt.Tasks { /// /// Contains a collection of elements. /// [Serializable] public class FileSetCollection : CollectionBase { /// /// Initializes a new instance of the /// class. /// public FileSetCollection() { } /// /// Initializes a new instance of the /// class /// with the specified /// instance. /// public FileSetCollection(FileSetCollection value) { this.AddRange(value); } /// /// Initializes a new instance of the /// class /// with the specified array of /// instances. /// public FileSetCollection(FileSet[] value) { this.AddRange(value); } /// /// Adds a to the end of /// the collection. /// /// /// The to be added to the end of /// the collection. /// /// The position into which the new element was inserted. public int Add(FileSet item) { return base.List.Add(item); } /// /// Adds the elements of a array to /// the end of the collection. /// /// /// The array of elements to be added /// to the end of the collection. /// public void AddRange(FileSet[] items) { for(int i = 0; i < items.Length; i++) { this.Add(items[i]); } } /// /// Adds the elements of a /// to the end of the collection. /// /// /// The to be added to /// the end of the collection. /// public void AddRange(FileSetCollection items) { for(int i = 0; i < items.Count; i++) { this.Add(items[i]); } } /// /// Determines whether a is in /// the collection. /// /// /// The to locate in the collection. /// /// /// if is found in /// the collection; otherwise, . /// public bool Contains(FileSet item) { return base.List.Contains(item); } /// /// Copies the entire collection to a compatible one-dimensional array, starting at /// the specified index of the target array. /// /// /// The one-dimensional array that is the destination of the elements copied from /// the collection. The array must have zero-based indexing. /// /// /// The zero-based index in at which copying begins. /// public void CopyTo(FileSet[] array, int index) { base.List.CopyTo(array, index); } /// Returns an enumerator that can iterate through the collection. /// /// A for /// the entire collection. /// public new FileSetEnumerator GetEnumerator() { return new FileSetEnumerator(this); } /// /// Retrieves the index of a specified /// object in the collection. /// /// /// The object for which the index /// is returned. /// /// /// The index of the specified . /// If the is not currently /// a member of the collection, it returns -1. /// public int IndexOf(FileSet item) { return base.List.IndexOf(item); } /// /// Inserts a into the collection at /// the specified index. /// /// /// The zero-based index at which should be inserted. /// /// /// The to insert. /// public void Insert(int index, FileSet item) { base.List.Insert(index, item); } /// Removes a member from the collection. /// /// The to remove from the collection. /// public void Remove(FileSet item) { base.List.Remove(item); } /// /// Get the total number of files that are represented by the filesets in /// this collection. /// public int FileCount { get { int fileCount = 0; foreach(FileSet fileset in base.List) { fileCount += fileset.FileNames.Count; } return fileCount; } } /// Gets or sets the element at the specified index. /// The zero-based index of the element to get or set. public FileSet this[int index] { get { return (FileSet)base.List[index]; } set { base.List[index] = value; } } } } // namespace Nuclex.NAnt.Tasks