* support-test-*.cs: Rename from test-*-p2.cs.
[mono.git] / mcs / class / System.Configuration.Install / System.Configuration.Install / InstallerCollection.cs
1 // System.Configuration.Install.Installer.cs
2 //
3 // Author:
4 //      Alejandro Sánchez Acosta  <raciel@es.gnu.org>
5 //
6 // (C) Alejandro Sánchez Acosta
7 // 
8
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 // 
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 // 
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //
29
30 using System.Collections;
31
32 namespace System.Configuration.Install
33 {
34         public class InstallerCollection : CollectionBase
35         {
36                 #region Constructors
37
38                 internal InstallerCollection(Installer owner)
39                 {
40                         this.owner = owner;
41                 }
42
43                 #endregion Constructors
44                 
45
46                 public Installer this[int index] {
47                         get 
48                         {
49                                 return (Installer) base.List[index];
50                         }
51                         set 
52                         {
53                                 base.List[index] = value;
54                         }
55                 }
56
57                 public int Add (Installer value) {
58                         return base.List.Add (value);
59                 }
60
61                 public void AddRange (Installer[] value) {
62                         if (value == null) 
63                         {
64                                 throw new ArgumentNullException ("value");
65                         }
66
67                         for (int counter = 0; counter < value.Length; counter++)
68                         {
69                                 Add (value[counter]);
70                         }
71                 }
72                         
73                 public void AddRange (InstallerCollection value) {
74                         if (value == null)
75                         {
76                                 throw new ArgumentNullException ("value");
77                         }
78
79                         int itemCount = value.Count;
80                         for (int counter = 0; counter < itemCount; counter++)
81                         {
82                                 Add (value[counter]);
83                         }
84                 }
85
86                 public bool Contains (Installer value) {
87                         return base.List.Contains (value);
88                 }               
89
90                 public void CopyTo (Installer[] array, int index) {
91                         base.List.CopyTo (array, index);
92                 }
93                 
94                 public int IndexOf (Installer value) {
95                         return base.List.IndexOf (value);
96                 }
97
98                 public void Insert (int index, Installer value) {
99                         base.List.Insert (index, value);
100                 }
101
102                 protected override void OnInsert (int index, object value) {
103                         ((Installer) value).parent = owner;
104                 }
105
106                 protected override void OnRemove (int index, object value) {
107                         ((Installer) value).parent = null;
108                 }
109
110                 protected override void OnSet (int index, object oldValue, object newValue) {
111                         ((Installer) oldValue).parent = null;
112                         ((Installer) newValue).parent = owner;
113                 }
114
115                 public void Remove (Installer value) {
116                         base.List.Remove(value);
117                 }
118
119                 #region Private Instance Fields
120
121                 private Installer owner;
122
123                 #endregion Private Instance Fields
124         }
125 }