diff options
Diffstat (limited to 'src/WixToolset.Core/Link/ConnectToModuleCollection.cs')
-rw-r--r-- | src/WixToolset.Core/Link/ConnectToModuleCollection.cs | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/WixToolset.Core/Link/ConnectToModuleCollection.cs b/src/WixToolset.Core/Link/ConnectToModuleCollection.cs new file mode 100644 index 00000000..6595487f --- /dev/null +++ b/src/WixToolset.Core/Link/ConnectToModuleCollection.cs | |||
@@ -0,0 +1,92 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Link | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Hash collection of connect to module objects. | ||
10 | /// </summary> | ||
11 | public sealed class ConnectToModuleCollection : ICollection | ||
12 | { | ||
13 | private Hashtable collection; | ||
14 | |||
15 | /// <summary> | ||
16 | /// Instantiate a new ConnectToModuleCollection class. | ||
17 | /// </summary> | ||
18 | public ConnectToModuleCollection() | ||
19 | { | ||
20 | this.collection = new Hashtable(); | ||
21 | } | ||
22 | |||
23 | /// <summary> | ||
24 | /// Gets the number of elements actually contained in the ConnectToModuleCollection. | ||
25 | /// </summary> | ||
26 | /// <value>The number of elements actually contained in the ConnectToModuleCollection.</value> | ||
27 | public int Count | ||
28 | { | ||
29 | get { return this.collection.Count; } | ||
30 | } | ||
31 | |||
32 | /// <summary> | ||
33 | /// Gets a value indicating whether access to the ConnectToModuleCollection is synchronized (thread-safe). | ||
34 | /// </summary> | ||
35 | /// <value>true if access to the ConnectToModuleCollection is synchronized (thread-safe); otherwise, false. The default is false.</value> | ||
36 | public bool IsSynchronized | ||
37 | { | ||
38 | get { return this.collection.IsSynchronized; } | ||
39 | } | ||
40 | |||
41 | /// <summary> | ||
42 | /// Gets an object that can be used to synchronize access to the ConnectToModuleCollection. | ||
43 | /// </summary> | ||
44 | /// <value>An object that can be used to synchronize access to the ConnectToModuleCollection.</value> | ||
45 | public object SyncRoot | ||
46 | { | ||
47 | get { return this.collection.SyncRoot; } | ||
48 | } | ||
49 | |||
50 | /// <summary> | ||
51 | /// Gets a module connection by child id. | ||
52 | /// </summary> | ||
53 | /// <param name="childId">Identifier of child to locate.</param> | ||
54 | public ConnectToModule this[string childId] | ||
55 | { | ||
56 | get { return (ConnectToModule)this.collection[childId]; } | ||
57 | } | ||
58 | |||
59 | /// <summary> | ||
60 | /// Adds a module connection to the collection. | ||
61 | /// </summary> | ||
62 | /// <param name="connection">Module connection to add.</param> | ||
63 | public void Add(ConnectToModule connection) | ||
64 | { | ||
65 | if (null == connection) | ||
66 | { | ||
67 | throw new ArgumentNullException("connection"); | ||
68 | } | ||
69 | |||
70 | this.collection.Add(connection.ChildId, connection); | ||
71 | } | ||
72 | |||
73 | /// <summary> | ||
74 | /// Copies the entire ConnectToModuleCollection to a compatible one-dimensional Array, starting at the specified index of the target array. | ||
75 | /// </summary> | ||
76 | /// <param name="array">The one-dimensional Array that is the destination of the elements copied from this ConnectToModuleCollection. The Array must have zero-based indexing.</param> | ||
77 | /// <param name="index">The zero-based index in array at which copying begins.</param> | ||
78 | public void CopyTo(System.Array array, int index) | ||
79 | { | ||
80 | this.collection.Keys.CopyTo(array, index); | ||
81 | } | ||
82 | |||
83 | /// <summary> | ||
84 | /// Returns an enumerator for the entire ConnectToModuleCollection. | ||
85 | /// </summary> | ||
86 | /// <returns>An IEnumerator for the entire ConnectToModuleCollection.</returns> | ||
87 | public IEnumerator GetEnumerator() | ||
88 | { | ||
89 | return this.collection.Keys.GetEnumerator(); | ||
90 | } | ||
91 | } | ||
92 | } | ||