namespace Microsoft.Build.BuildEngine {
public class ImportCollection : ICollection, IEnumerable {
- List <Import> imports;
- Project parentProject;
+ GroupingCollection groupingCollection;
+ Dictionary <string, object> filenames;
- internal ImportCollection (Project parentProject)
+ internal ImportCollection (GroupingCollection groupingCollection)
{
- this.parentProject = parentProject;
- this.imports = new List <Import> ();
+ this.groupingCollection = groupingCollection;
+ filenames = new Dictionary <string, object> ();
}
internal void Add (Import import)
{
- if (import == null)
- throw new ArgumentNullException ("import");
-
- if (imports.Contains (import))
- throw new InvalidOperationException ("Import already added.");
-
- imports.Add (import);
+ if (!filenames.ContainsKey (import.ProjectPath)) {
+ groupingCollection.Add (import);
+ filenames.Add (import.ProjectPath, null);
+ }
}
- [MonoTODO]
public void CopyTo (Array array, int index)
{
- throw new NotImplementedException ();
+ if (array == null)
+ throw new ArgumentNullException ("array");
+ if (index < 0)
+ throw new ArgumentOutOfRangeException ("Index was outside the bounds of the array.");
+ if (array.Rank > 1)
+ throw new ArgumentException ("array is multidimensional");
+ if ((array.Length > 0) && (index >= array.Length))
+ throw new ArgumentException ("Index was outside the bounds of the array.");
+ if (index + this.Count > array.Length)
+ throw new ArgumentException ("Not enough room from index to end of array for this BuildItemGroupCollection");
+
+ IEnumerator it = GetEnumerator ();
+ int i = index;
+ while (it.MoveNext ()) {
+ array.SetValue(it.Current, i++);
+ }
}
- [MonoTODO]
public void CopyTo (Import[] array, int index)
{
- throw new NotImplementedException ();
+ CopyTo ((Array) array, index);
}
public IEnumerator GetEnumerator ()
{
- foreach (Import i in imports)
- yield return i;
+ return groupingCollection.GetImportEnumerator ();
}
public int Count {
- get { return imports.Count; }
+ get { return groupingCollection.Imports; }
}
public bool IsSynchronized {
}
public object SyncRoot {
- get { return this; }
+ get { return null; }
}
}
}