X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FMicrosoft.Build.Engine%2FMicrosoft.Build.BuildEngine%2FImportCollection.cs;h=988ac50e5641bc1961b11196f4ed07415691d1c0;hb=2f674e84d8ba0308c9cd4c3de896ebc5ae3dcc47;hp=52d03c779835f91445ddad081fb049a3135be86b;hpb=f84f760a1c8a8c0ec6ae16b7f38d14a49d329ad7;p=mono.git diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ImportCollection.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ImportCollection.cs index 52d03c77983..988ac50e564 100644 --- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ImportCollection.cs +++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ImportCollection.cs @@ -36,46 +36,55 @@ using System.Xml; namespace Microsoft.Build.BuildEngine { public class ImportCollection : ICollection, IEnumerable { - List imports; - Project parentProject; + GroupingCollection groupingCollection; + Dictionary filenames; - internal ImportCollection (Project parentProject) + internal ImportCollection (GroupingCollection groupingCollection) { - this.parentProject = parentProject; - this.imports = new List (); + this.groupingCollection = groupingCollection; + filenames = new Dictionary (); } 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 { @@ -83,7 +92,7 @@ namespace Microsoft.Build.BuildEngine { } public object SyncRoot { - get { return this; } + get { return null; } } } }