diff options
Diffstat (limited to 'Prebuild/src/Core/Nodes/ConfigurationNode.cs')
-rw-r--r-- | Prebuild/src/Core/Nodes/ConfigurationNode.cs | 372 |
1 files changed, 186 insertions, 186 deletions
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs index cd2f740..a101799 100644 --- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs +++ b/Prebuild/src/Core/Nodes/ConfigurationNode.cs | |||
@@ -5,16 +5,16 @@ Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehea | |||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
@@ -32,185 +32,185 @@ using Prebuild.Core.Utilities; | |||
32 | 32 | ||
33 | namespace Prebuild.Core.Nodes | 33 | namespace Prebuild.Core.Nodes |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// | 36 | /// |
37 | /// </summary> | 37 | /// </summary> |
38 | [DataNode("Configuration")] | 38 | [DataNode("Configuration")] |
39 | public class ConfigurationNode : DataNode, ICloneable, IComparable | 39 | public class ConfigurationNode : DataNode, ICloneable, IComparable |
40 | { | 40 | { |
41 | #region Fields | 41 | #region Fields |
42 | 42 | ||
43 | private string m_Name = "unknown"; | 43 | private string m_Name = "unknown"; |
44 | private string m_Platform = "AnyCPU"; | 44 | private string m_Platform = "AnyCPU"; |
45 | private OptionsNode m_Options; | 45 | private OptionsNode m_Options; |
46 | 46 | ||
47 | #endregion | 47 | #endregion |
48 | 48 | ||
49 | #region Constructors | 49 | #region Constructors |
50 | 50 | ||
51 | /// <summary> | 51 | /// <summary> |
52 | /// Initializes a new instance of the <see cref="ConfigurationNode"/> class. | 52 | /// Initializes a new instance of the <see cref="ConfigurationNode"/> class. |
53 | /// </summary> | 53 | /// </summary> |
54 | public ConfigurationNode() | 54 | public ConfigurationNode() |
55 | { | 55 | { |
56 | m_Options = new OptionsNode(); | 56 | m_Options = new OptionsNode(); |
57 | } | 57 | } |
58 | 58 | ||
59 | #endregion | 59 | #endregion |
60 | 60 | ||
61 | #region Properties | 61 | #region Properties |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// Gets or sets the parent. | 64 | /// Gets or sets the parent. |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <value>The parent.</value> | 66 | /// <value>The parent.</value> |
67 | public override IDataNode Parent | 67 | public override IDataNode Parent |
68 | { | 68 | { |
69 | get | 69 | get |
70 | { | 70 | { |
71 | return base.Parent; | 71 | return base.Parent; |
72 | } | 72 | } |
73 | set | 73 | set |
74 | { | 74 | { |
75 | base.Parent = value; | 75 | base.Parent = value; |
76 | if(base.Parent is SolutionNode) | 76 | if(base.Parent is SolutionNode) |
77 | { | 77 | { |
78 | SolutionNode node = (SolutionNode)base.Parent; | 78 | SolutionNode node = (SolutionNode)base.Parent; |
79 | if(node != null && node.Options != null) | 79 | if(node != null && node.Options != null) |
80 | { | 80 | { |
81 | node.Options.CopyTo(m_Options); | 81 | node.Options.CopyTo(m_Options); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | /// <summary> | 87 | /// <summary> |
88 | /// Identifies the platform for this specific configuration. | 88 | /// Identifies the platform for this specific configuration. |
89 | /// </summary> | 89 | /// </summary> |
90 | public string Platform | 90 | public string Platform |
91 | { | 91 | { |
92 | get | 92 | get |
93 | { | 93 | { |
94 | return m_Platform; | 94 | return m_Platform; |
95 | } | 95 | } |
96 | set | 96 | set |
97 | { | 97 | { |
98 | switch ((value + "").ToLower()) | 98 | switch ((value + "").ToLower()) |
99 | { | 99 | { |
100 | case "x86": | 100 | case "x86": |
101 | case "x64": | 101 | case "x64": |
102 | m_Platform = value; | 102 | m_Platform = value; |
103 | break; | 103 | break; |
104 | case "itanium": | 104 | case "itanium": |
105 | m_Platform = "Itanium"; | 105 | m_Platform = "Itanium"; |
106 | break; | 106 | break; |
107 | default: | 107 | default: |
108 | m_Platform = "AnyCPU"; | 108 | m_Platform = "AnyCPU"; |
109 | break; | 109 | break; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | /// <summary> | 114 | /// <summary> |
115 | /// Gets the name. | 115 | /// Gets the name. |
116 | /// </summary> | 116 | /// </summary> |
117 | /// <value>The name.</value> | 117 | /// <value>The name.</value> |
118 | public string Name | 118 | public string Name |
119 | { | 119 | { |
120 | get | 120 | get |
121 | { | 121 | { |
122 | return m_Name; | 122 | return m_Name; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | /// <summary> | 126 | /// <summary> |
127 | /// Gets the name and platform for the configuration. | 127 | /// Gets the name and platform for the configuration. |
128 | /// </summary> | 128 | /// </summary> |
129 | /// <value>The name and platform.</value> | 129 | /// <value>The name and platform.</value> |
130 | public string NameAndPlatform | 130 | public string NameAndPlatform |
131 | { | 131 | { |
132 | get | 132 | get |
133 | { | 133 | { |
134 | string platform = m_Platform; | 134 | string platform = m_Platform; |
135 | if (platform == "AnyCPU") | 135 | if (platform == "AnyCPU") |
136 | platform = "Any CPU"; | 136 | platform = "Any CPU"; |
137 | 137 | ||
138 | return String.Format("{0}|{1}", m_Name, platform); | 138 | return String.Format("{0}|{1}", m_Name, platform); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | /// <summary> | 142 | /// <summary> |
143 | /// Gets or sets the options. | 143 | /// Gets or sets the options. |
144 | /// </summary> | 144 | /// </summary> |
145 | /// <value>The options.</value> | 145 | /// <value>The options.</value> |
146 | public OptionsNode Options | 146 | public OptionsNode Options |
147 | { | 147 | { |
148 | get | 148 | get |
149 | { | 149 | { |
150 | return m_Options; | 150 | return m_Options; |
151 | } | 151 | } |
152 | set | 152 | set |
153 | { | 153 | { |
154 | m_Options = value; | 154 | m_Options = value; |
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | #endregion | 158 | #endregion |
159 | 159 | ||
160 | #region Public Methods | 160 | #region Public Methods |
161 | 161 | ||
162 | /// <summary> | 162 | /// <summary> |
163 | /// Parses the specified node. | 163 | /// Parses the specified node. |
164 | /// </summary> | 164 | /// </summary> |
165 | /// <param name="node">The node.</param> | 165 | /// <param name="node">The node.</param> |
166 | public override void Parse(XmlNode node) | 166 | public override void Parse(XmlNode node) |
167 | { | 167 | { |
168 | m_Name = Helper.AttributeValue(node, "name", m_Name); | 168 | m_Name = Helper.AttributeValue(node, "name", m_Name); |
169 | Platform = Helper.AttributeValue(node, "platform", m_Platform); | 169 | Platform = Helper.AttributeValue(node, "platform", m_Platform); |
170 | 170 | ||
171 | if (node == null) | 171 | if (node == null) |
172 | { | 172 | { |
173 | throw new ArgumentNullException("node"); | 173 | throw new ArgumentNullException("node"); |
174 | } | 174 | } |
175 | foreach(XmlNode child in node.ChildNodes) | 175 | foreach(XmlNode child in node.ChildNodes) |
176 | { | 176 | { |
177 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | 177 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); |
178 | if(dataNode is OptionsNode) | 178 | if(dataNode is OptionsNode) |
179 | { | 179 | { |
180 | ((OptionsNode)dataNode).CopyTo(m_Options); | 180 | ((OptionsNode)dataNode).CopyTo(m_Options); |
181 | } | 181 | } |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | /// <summary> | 185 | /// <summary> |
186 | /// Copies to. | 186 | /// Copies to. |
187 | /// </summary> | 187 | /// </summary> |
188 | /// <param name="conf">The conf.</param> | 188 | /// <param name="conf">The conf.</param> |
189 | public void CopyTo(ConfigurationNode conf) | 189 | public void CopyTo(ConfigurationNode conf) |
190 | { | 190 | { |
191 | m_Options.CopyTo(conf.m_Options); | 191 | m_Options.CopyTo(conf.m_Options); |
192 | } | 192 | } |
193 | 193 | ||
194 | #endregion | 194 | #endregion |
195 | 195 | ||
196 | #region ICloneable Members | 196 | #region ICloneable Members |
197 | 197 | ||
198 | /// <summary> | 198 | /// <summary> |
199 | /// Creates a new object that is a copy of the current instance. | 199 | /// Creates a new object that is a copy of the current instance. |
200 | /// </summary> | 200 | /// </summary> |
201 | /// <returns> | 201 | /// <returns> |
202 | /// A new object that is a copy of this instance. | 202 | /// A new object that is a copy of this instance. |
203 | /// </returns> | 203 | /// </returns> |
204 | public object Clone() | 204 | public object Clone() |
205 | { | 205 | { |
206 | ConfigurationNode ret = new ConfigurationNode(); | 206 | ConfigurationNode ret = new ConfigurationNode(); |
207 | ret.m_Name = m_Name; | 207 | ret.m_Name = m_Name; |
208 | ret.m_Platform = m_Platform; | 208 | ret.m_Platform = m_Platform; |
209 | m_Options.CopyTo(ret.m_Options); | 209 | m_Options.CopyTo(ret.m_Options); |
210 | return ret; | 210 | return ret; |
211 | } | 211 | } |
212 | 212 | ||
213 | #endregion | 213 | #endregion |
214 | 214 | ||
215 | #region IComparable Members | 215 | #region IComparable Members |
216 | 216 | ||
@@ -221,5 +221,5 @@ namespace Prebuild.Core.Nodes | |||
221 | } | 221 | } |
222 | 222 | ||
223 | #endregion | 223 | #endregion |
224 | } | 224 | } |
225 | } | 225 | } |