diff options
Diffstat (limited to 'Prebuild/src/Core/Nodes/OptionsNode.cs')
-rw-r--r-- | Prebuild/src/Core/Nodes/OptionsNode.cs | 1310 |
1 files changed, 655 insertions, 655 deletions
diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs index b5a2f60..b7a784d 100644 --- a/Prebuild/src/Core/Nodes/OptionsNode.cs +++ b/Prebuild/src/Core/Nodes/OptionsNode.cs | |||
@@ -1,655 +1,655 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
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 |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2007-01-08 17:55:40 +0100 (må, 08 jan 2007) $ | 30 | * $Date: 2007-01-08 17:55:40 +0100 (må, 08 jan 2007) $ |
31 | * $Revision: 197 $ | 31 | * $Revision: 197 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | using System; | 37 | using System; |
38 | using System.Collections; | 38 | using System.Collections; |
39 | using System.Collections.Specialized; | 39 | using System.Collections.Specialized; |
40 | using System.Reflection; | 40 | using System.Reflection; |
41 | using System.Xml; | 41 | using System.Xml; |
42 | 42 | ||
43 | using Prebuild.Core.Attributes; | 43 | using Prebuild.Core.Attributes; |
44 | using Prebuild.Core.Interfaces; | 44 | using Prebuild.Core.Interfaces; |
45 | using Prebuild.Core.Utilities; | 45 | using Prebuild.Core.Utilities; |
46 | 46 | ||
47 | namespace Prebuild.Core.Nodes | 47 | namespace Prebuild.Core.Nodes |
48 | { | 48 | { |
49 | /// <summary> | 49 | /// <summary> |
50 | /// | 50 | /// |
51 | /// </summary> | 51 | /// </summary> |
52 | [DataNode("Options")] | 52 | [DataNode("Options")] |
53 | public class OptionsNode : DataNode | 53 | public class OptionsNode : DataNode |
54 | { | 54 | { |
55 | #region Fields | 55 | #region Fields |
56 | 56 | ||
57 | private static Hashtable m_OptionFields; | 57 | private static Hashtable m_OptionFields; |
58 | 58 | ||
59 | [OptionNode("CompilerDefines")] | 59 | [OptionNode("CompilerDefines")] |
60 | private string m_CompilerDefines = ""; | 60 | private string m_CompilerDefines = ""; |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// | 63 | /// |
64 | /// </summary> | 64 | /// </summary> |
65 | public string CompilerDefines | 65 | public string CompilerDefines |
66 | { | 66 | { |
67 | get | 67 | get |
68 | { | 68 | { |
69 | return m_CompilerDefines; | 69 | return m_CompilerDefines; |
70 | } | 70 | } |
71 | set | 71 | set |
72 | { | 72 | { |
73 | m_CompilerDefines = value; | 73 | m_CompilerDefines = value; |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | [OptionNode("OptimizeCode")] | 77 | [OptionNode("OptimizeCode")] |
78 | private bool m_OptimizeCode; | 78 | private bool m_OptimizeCode; |
79 | 79 | ||
80 | /// <summary> | 80 | /// <summary> |
81 | /// | 81 | /// |
82 | /// </summary> | 82 | /// </summary> |
83 | public bool OptimizeCode | 83 | public bool OptimizeCode |
84 | { | 84 | { |
85 | get | 85 | get |
86 | { | 86 | { |
87 | return m_OptimizeCode; | 87 | return m_OptimizeCode; |
88 | } | 88 | } |
89 | set | 89 | set |
90 | { | 90 | { |
91 | m_OptimizeCode = value; | 91 | m_OptimizeCode = value; |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | [OptionNode("CheckUnderflowOverflow")] | 95 | [OptionNode("CheckUnderflowOverflow")] |
96 | private bool m_CheckUnderflowOverflow; | 96 | private bool m_CheckUnderflowOverflow; |
97 | 97 | ||
98 | /// <summary> | 98 | /// <summary> |
99 | /// | 99 | /// |
100 | /// </summary> | 100 | /// </summary> |
101 | public bool CheckUnderflowOverflow | 101 | public bool CheckUnderflowOverflow |
102 | { | 102 | { |
103 | get | 103 | get |
104 | { | 104 | { |
105 | return m_CheckUnderflowOverflow; | 105 | return m_CheckUnderflowOverflow; |
106 | } | 106 | } |
107 | set | 107 | set |
108 | { | 108 | { |
109 | m_CheckUnderflowOverflow = value; | 109 | m_CheckUnderflowOverflow = value; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | [OptionNode("AllowUnsafe")] | 113 | [OptionNode("AllowUnsafe")] |
114 | private bool m_AllowUnsafe; | 114 | private bool m_AllowUnsafe; |
115 | 115 | ||
116 | /// <summary> | 116 | /// <summary> |
117 | /// | 117 | /// |
118 | /// </summary> | 118 | /// </summary> |
119 | public bool AllowUnsafe | 119 | public bool AllowUnsafe |
120 | { | 120 | { |
121 | get | 121 | get |
122 | { | 122 | { |
123 | return m_AllowUnsafe; | 123 | return m_AllowUnsafe; |
124 | } | 124 | } |
125 | set | 125 | set |
126 | { | 126 | { |
127 | m_AllowUnsafe = value; | 127 | m_AllowUnsafe = value; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | [OptionNode("PreBuildEvent")] | 131 | [OptionNode("PreBuildEvent")] |
132 | private string m_PreBuildEvent; | 132 | private string m_PreBuildEvent; |
133 | 133 | ||
134 | /// <summary> | 134 | /// <summary> |
135 | /// | 135 | /// |
136 | /// </summary> | 136 | /// </summary> |
137 | public string PreBuildEvent | 137 | public string PreBuildEvent |
138 | { | 138 | { |
139 | get | 139 | get |
140 | { | 140 | { |
141 | return m_PreBuildEvent; | 141 | return m_PreBuildEvent; |
142 | } | 142 | } |
143 | set | 143 | set |
144 | { | 144 | { |
145 | m_PreBuildEvent = value; | 145 | m_PreBuildEvent = value; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | [OptionNode("PostBuildEvent")] | 149 | [OptionNode("PostBuildEvent")] |
150 | private string m_PostBuildEvent; | 150 | private string m_PostBuildEvent; |
151 | 151 | ||
152 | /// <summary> | 152 | /// <summary> |
153 | /// | 153 | /// |
154 | /// </summary> | 154 | /// </summary> |
155 | public string PostBuildEvent | 155 | public string PostBuildEvent |
156 | { | 156 | { |
157 | get | 157 | get |
158 | { | 158 | { |
159 | return m_PostBuildEvent; | 159 | return m_PostBuildEvent; |
160 | } | 160 | } |
161 | set | 161 | set |
162 | { | 162 | { |
163 | m_PostBuildEvent = value; | 163 | m_PostBuildEvent = value; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | [OptionNode("PreBuildEventArgs")] | 167 | [OptionNode("PreBuildEventArgs")] |
168 | private string m_PreBuildEventArgs; | 168 | private string m_PreBuildEventArgs; |
169 | 169 | ||
170 | /// <summary> | 170 | /// <summary> |
171 | /// | 171 | /// |
172 | /// </summary> | 172 | /// </summary> |
173 | public string PreBuildEventArgs | 173 | public string PreBuildEventArgs |
174 | { | 174 | { |
175 | get | 175 | get |
176 | { | 176 | { |
177 | return m_PreBuildEventArgs; | 177 | return m_PreBuildEventArgs; |
178 | } | 178 | } |
179 | set | 179 | set |
180 | { | 180 | { |
181 | m_PreBuildEventArgs = value; | 181 | m_PreBuildEventArgs = value; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | [OptionNode("PostBuildEventArgs")] | 185 | [OptionNode("PostBuildEventArgs")] |
186 | private string m_PostBuildEventArgs; | 186 | private string m_PostBuildEventArgs; |
187 | 187 | ||
188 | /// <summary> | 188 | /// <summary> |
189 | /// | 189 | /// |
190 | /// </summary> | 190 | /// </summary> |
191 | public string PostBuildEventArgs | 191 | public string PostBuildEventArgs |
192 | { | 192 | { |
193 | get | 193 | get |
194 | { | 194 | { |
195 | return m_PostBuildEventArgs; | 195 | return m_PostBuildEventArgs; |
196 | } | 196 | } |
197 | set | 197 | set |
198 | { | 198 | { |
199 | m_PostBuildEventArgs = value; | 199 | m_PostBuildEventArgs = value; |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | [OptionNode("RunPostBuildEvent")] | 203 | [OptionNode("RunPostBuildEvent")] |
204 | private string m_RunPostBuildEvent; | 204 | private string m_RunPostBuildEvent; |
205 | 205 | ||
206 | /// <summary> | 206 | /// <summary> |
207 | /// | 207 | /// |
208 | /// </summary> | 208 | /// </summary> |
209 | public string RunPostBuildEvent | 209 | public string RunPostBuildEvent |
210 | { | 210 | { |
211 | get | 211 | get |
212 | { | 212 | { |
213 | return m_RunPostBuildEvent; | 213 | return m_RunPostBuildEvent; |
214 | } | 214 | } |
215 | set | 215 | set |
216 | { | 216 | { |
217 | m_RunPostBuildEvent = value; | 217 | m_RunPostBuildEvent = value; |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | [OptionNode("RunScript")] | 221 | [OptionNode("RunScript")] |
222 | private string m_RunScript; | 222 | private string m_RunScript; |
223 | 223 | ||
224 | /// <summary> | 224 | /// <summary> |
225 | /// | 225 | /// |
226 | /// </summary> | 226 | /// </summary> |
227 | public string RunScript | 227 | public string RunScript |
228 | { | 228 | { |
229 | get | 229 | get |
230 | { | 230 | { |
231 | return m_RunScript; | 231 | return m_RunScript; |
232 | } | 232 | } |
233 | set | 233 | set |
234 | { | 234 | { |
235 | m_RunScript = value; | 235 | m_RunScript = value; |
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | [OptionNode("WarningLevel")] | 239 | [OptionNode("WarningLevel")] |
240 | private int m_WarningLevel = 4; | 240 | private int m_WarningLevel = 4; |
241 | 241 | ||
242 | /// <summary> | 242 | /// <summary> |
243 | /// | 243 | /// |
244 | /// </summary> | 244 | /// </summary> |
245 | public int WarningLevel | 245 | public int WarningLevel |
246 | { | 246 | { |
247 | get | 247 | get |
248 | { | 248 | { |
249 | return m_WarningLevel; | 249 | return m_WarningLevel; |
250 | } | 250 | } |
251 | set | 251 | set |
252 | { | 252 | { |
253 | m_WarningLevel = value; | 253 | m_WarningLevel = value; |
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | [OptionNode("WarningsAsErrors")] | 257 | [OptionNode("WarningsAsErrors")] |
258 | private bool m_WarningsAsErrors; | 258 | private bool m_WarningsAsErrors; |
259 | 259 | ||
260 | /// <summary> | 260 | /// <summary> |
261 | /// | 261 | /// |
262 | /// </summary> | 262 | /// </summary> |
263 | public bool WarningsAsErrors | 263 | public bool WarningsAsErrors |
264 | { | 264 | { |
265 | get | 265 | get |
266 | { | 266 | { |
267 | return m_WarningsAsErrors; | 267 | return m_WarningsAsErrors; |
268 | } | 268 | } |
269 | set | 269 | set |
270 | { | 270 | { |
271 | m_WarningsAsErrors = value; | 271 | m_WarningsAsErrors = value; |
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | [OptionNode("SuppressWarnings")] | 275 | [OptionNode("SuppressWarnings")] |
276 | private string m_SuppressWarnings = ""; | 276 | private string m_SuppressWarnings = ""; |
277 | 277 | ||
278 | /// <summary> | 278 | /// <summary> |
279 | /// | 279 | /// |
280 | /// </summary> | 280 | /// </summary> |
281 | public string SuppressWarnings | 281 | public string SuppressWarnings |
282 | { | 282 | { |
283 | get | 283 | get |
284 | { | 284 | { |
285 | return m_SuppressWarnings; | 285 | return m_SuppressWarnings; |
286 | } | 286 | } |
287 | set | 287 | set |
288 | { | 288 | { |
289 | m_SuppressWarnings = value; | 289 | m_SuppressWarnings = value; |
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | [OptionNode("OutputPath")] | 293 | [OptionNode("OutputPath")] |
294 | private string m_OutputPath = "bin/"; | 294 | private string m_OutputPath = "bin/"; |
295 | 295 | ||
296 | /// <summary> | 296 | /// <summary> |
297 | /// | 297 | /// |
298 | /// </summary> | 298 | /// </summary> |
299 | public string OutputPath | 299 | public string OutputPath |
300 | { | 300 | { |
301 | get | 301 | get |
302 | { | 302 | { |
303 | return m_OutputPath; | 303 | return m_OutputPath; |
304 | } | 304 | } |
305 | set | 305 | set |
306 | { | 306 | { |
307 | m_OutputPath = value; | 307 | m_OutputPath = value; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
311 | [OptionNode("GenerateDocumentation")] | 311 | [OptionNode("GenerateDocumentation")] |
312 | private bool m_GenerateDocumentation; | 312 | private bool m_GenerateDocumentation; |
313 | 313 | ||
314 | /// <summary> | 314 | /// <summary> |
315 | /// | 315 | /// |
316 | /// </summary> | 316 | /// </summary> |
317 | public bool GenerateDocumentation | 317 | public bool GenerateDocumentation |
318 | { | 318 | { |
319 | get | 319 | get |
320 | { | 320 | { |
321 | return m_GenerateDocumentation; | 321 | return m_GenerateDocumentation; |
322 | } | 322 | } |
323 | set | 323 | set |
324 | { | 324 | { |
325 | m_GenerateDocumentation = value; | 325 | m_GenerateDocumentation = value; |
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | [OptionNode("GenerateXmlDocFile")] | 329 | [OptionNode("GenerateXmlDocFile")] |
330 | private bool m_GenerateXmlDocFile; | 330 | private bool m_GenerateXmlDocFile; |
331 | 331 | ||
332 | /// <summary> | 332 | /// <summary> |
333 | /// | 333 | /// |
334 | /// </summary> | 334 | /// </summary> |
335 | public bool GenerateXmlDocFile | 335 | public bool GenerateXmlDocFile |
336 | { | 336 | { |
337 | get | 337 | get |
338 | { | 338 | { |
339 | return m_GenerateXmlDocFile; | 339 | return m_GenerateXmlDocFile; |
340 | } | 340 | } |
341 | set | 341 | set |
342 | { | 342 | { |
343 | m_GenerateXmlDocFile = value; | 343 | m_GenerateXmlDocFile = value; |
344 | } | 344 | } |
345 | } | 345 | } |
346 | 346 | ||
347 | [OptionNode("XmlDocFile")] | 347 | [OptionNode("XmlDocFile")] |
348 | private string m_XmlDocFile = ""; | 348 | private string m_XmlDocFile = ""; |
349 | 349 | ||
350 | /// <summary> | 350 | /// <summary> |
351 | /// | 351 | /// |
352 | /// </summary> | 352 | /// </summary> |
353 | public string XmlDocFile | 353 | public string XmlDocFile |
354 | { | 354 | { |
355 | get | 355 | get |
356 | { | 356 | { |
357 | return m_XmlDocFile; | 357 | return m_XmlDocFile; |
358 | } | 358 | } |
359 | set | 359 | set |
360 | { | 360 | { |
361 | m_XmlDocFile = value; | 361 | m_XmlDocFile = value; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | [OptionNode("KeyFile")] | 365 | [OptionNode("KeyFile")] |
366 | private string m_KeyFile = ""; | 366 | private string m_KeyFile = ""; |
367 | 367 | ||
368 | /// <summary> | 368 | /// <summary> |
369 | /// | 369 | /// |
370 | /// </summary> | 370 | /// </summary> |
371 | public string KeyFile | 371 | public string KeyFile |
372 | { | 372 | { |
373 | get | 373 | get |
374 | { | 374 | { |
375 | return m_KeyFile; | 375 | return m_KeyFile; |
376 | } | 376 | } |
377 | set | 377 | set |
378 | { | 378 | { |
379 | m_KeyFile = value; | 379 | m_KeyFile = value; |
380 | } | 380 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | [OptionNode("DebugInformation")] | 383 | [OptionNode("DebugInformation")] |
384 | private bool m_DebugInformation; | 384 | private bool m_DebugInformation; |
385 | 385 | ||
386 | /// <summary> | 386 | /// <summary> |
387 | /// | 387 | /// |
388 | /// </summary> | 388 | /// </summary> |
389 | public bool DebugInformation | 389 | public bool DebugInformation |
390 | { | 390 | { |
391 | get | 391 | get |
392 | { | 392 | { |
393 | return m_DebugInformation; | 393 | return m_DebugInformation; |
394 | } | 394 | } |
395 | set | 395 | set |
396 | { | 396 | { |
397 | m_DebugInformation = value; | 397 | m_DebugInformation = value; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | [OptionNode("RegisterComInterop")] | 401 | [OptionNode("RegisterComInterop")] |
402 | private bool m_RegisterComInterop; | 402 | private bool m_RegisterComInterop; |
403 | 403 | ||
404 | /// <summary> | 404 | /// <summary> |
405 | /// | 405 | /// |
406 | /// </summary> | 406 | /// </summary> |
407 | public bool RegisterComInterop | 407 | public bool RegisterComInterop |
408 | { | 408 | { |
409 | get | 409 | get |
410 | { | 410 | { |
411 | return m_RegisterComInterop; | 411 | return m_RegisterComInterop; |
412 | } | 412 | } |
413 | set | 413 | set |
414 | { | 414 | { |
415 | m_RegisterComInterop = value; | 415 | m_RegisterComInterop = value; |
416 | } | 416 | } |
417 | } | 417 | } |
418 | 418 | ||
419 | [OptionNode("RemoveIntegerChecks")] | 419 | [OptionNode("RemoveIntegerChecks")] |
420 | private bool m_RemoveIntegerChecks; | 420 | private bool m_RemoveIntegerChecks; |
421 | 421 | ||
422 | /// <summary> | 422 | /// <summary> |
423 | /// | 423 | /// |
424 | /// </summary> | 424 | /// </summary> |
425 | public bool RemoveIntegerChecks | 425 | public bool RemoveIntegerChecks |
426 | { | 426 | { |
427 | get | 427 | get |
428 | { | 428 | { |
429 | return m_RemoveIntegerChecks; | 429 | return m_RemoveIntegerChecks; |
430 | } | 430 | } |
431 | set | 431 | set |
432 | { | 432 | { |
433 | m_RemoveIntegerChecks = value; | 433 | m_RemoveIntegerChecks = value; |
434 | } | 434 | } |
435 | } | 435 | } |
436 | 436 | ||
437 | [OptionNode("IncrementalBuild")] | 437 | [OptionNode("IncrementalBuild")] |
438 | private bool m_IncrementalBuild; | 438 | private bool m_IncrementalBuild; |
439 | 439 | ||
440 | /// <summary> | 440 | /// <summary> |
441 | /// | 441 | /// |
442 | /// </summary> | 442 | /// </summary> |
443 | public bool IncrementalBuild | 443 | public bool IncrementalBuild |
444 | { | 444 | { |
445 | get | 445 | get |
446 | { | 446 | { |
447 | return m_IncrementalBuild; | 447 | return m_IncrementalBuild; |
448 | } | 448 | } |
449 | set | 449 | set |
450 | { | 450 | { |
451 | m_IncrementalBuild = value; | 451 | m_IncrementalBuild = value; |
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||
455 | [OptionNode("BaseAddress")] | 455 | [OptionNode("BaseAddress")] |
456 | private string m_BaseAddress = "285212672"; | 456 | private string m_BaseAddress = "285212672"; |
457 | 457 | ||
458 | /// <summary> | 458 | /// <summary> |
459 | /// | 459 | /// |
460 | /// </summary> | 460 | /// </summary> |
461 | public string BaseAddress | 461 | public string BaseAddress |
462 | { | 462 | { |
463 | get | 463 | get |
464 | { | 464 | { |
465 | return m_BaseAddress; | 465 | return m_BaseAddress; |
466 | } | 466 | } |
467 | set | 467 | set |
468 | { | 468 | { |
469 | m_BaseAddress = value; | 469 | m_BaseAddress = value; |
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
473 | [OptionNode("FileAlignment")] | 473 | [OptionNode("FileAlignment")] |
474 | private int m_FileAlignment = 4096; | 474 | private int m_FileAlignment = 4096; |
475 | 475 | ||
476 | /// <summary> | 476 | /// <summary> |
477 | /// | 477 | /// |
478 | /// </summary> | 478 | /// </summary> |
479 | public int FileAlignment | 479 | public int FileAlignment |
480 | { | 480 | { |
481 | get | 481 | get |
482 | { | 482 | { |
483 | return m_FileAlignment; | 483 | return m_FileAlignment; |
484 | } | 484 | } |
485 | set | 485 | set |
486 | { | 486 | { |
487 | m_FileAlignment = value; | 487 | m_FileAlignment = value; |
488 | } | 488 | } |
489 | } | 489 | } |
490 | 490 | ||
491 | [OptionNode("NoStdLib")] | 491 | [OptionNode("NoStdLib")] |
492 | private bool m_NoStdLib; | 492 | private bool m_NoStdLib; |
493 | 493 | ||
494 | /// <summary> | 494 | /// <summary> |
495 | /// | 495 | /// |
496 | /// </summary> | 496 | /// </summary> |
497 | public bool NoStdLib | 497 | public bool NoStdLib |
498 | { | 498 | { |
499 | get | 499 | get |
500 | { | 500 | { |
501 | return m_NoStdLib; | 501 | return m_NoStdLib; |
502 | } | 502 | } |
503 | set | 503 | set |
504 | { | 504 | { |
505 | m_NoStdLib = value; | 505 | m_NoStdLib = value; |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | private StringCollection m_FieldsDefined; | 509 | private StringCollection m_FieldsDefined; |
510 | 510 | ||
511 | #endregion | 511 | #endregion |
512 | 512 | ||
513 | #region Constructors | 513 | #region Constructors |
514 | 514 | ||
515 | /// <summary> | 515 | /// <summary> |
516 | /// Initializes the <see cref="OptionsNode"/> class. | 516 | /// Initializes the <see cref="OptionsNode"/> class. |
517 | /// </summary> | 517 | /// </summary> |
518 | static OptionsNode() | 518 | static OptionsNode() |
519 | { | 519 | { |
520 | Type t = typeof(OptionsNode); | 520 | Type t = typeof(OptionsNode); |
521 | 521 | ||
522 | m_OptionFields = new Hashtable(); | 522 | m_OptionFields = new Hashtable(); |
523 | foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) | 523 | foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) |
524 | { | 524 | { |
525 | object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); | 525 | object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); |
526 | if(attrs == null || attrs.Length < 1) | 526 | if(attrs == null || attrs.Length < 1) |
527 | { | 527 | { |
528 | continue; | 528 | continue; |
529 | } | 529 | } |
530 | 530 | ||
531 | OptionNodeAttribute ona = (OptionNodeAttribute)attrs[0]; | 531 | OptionNodeAttribute ona = (OptionNodeAttribute)attrs[0]; |
532 | m_OptionFields[ona.NodeName] = f; | 532 | m_OptionFields[ona.NodeName] = f; |
533 | } | 533 | } |
534 | } | 534 | } |
535 | 535 | ||
536 | /// <summary> | 536 | /// <summary> |
537 | /// Initializes a new instance of the <see cref="OptionsNode"/> class. | 537 | /// Initializes a new instance of the <see cref="OptionsNode"/> class. |
538 | /// </summary> | 538 | /// </summary> |
539 | public OptionsNode() | 539 | public OptionsNode() |
540 | { | 540 | { |
541 | m_FieldsDefined = new StringCollection(); | 541 | m_FieldsDefined = new StringCollection(); |
542 | } | 542 | } |
543 | 543 | ||
544 | #endregion | 544 | #endregion |
545 | 545 | ||
546 | #region Properties | 546 | #region Properties |
547 | 547 | ||
548 | /// <summary> | 548 | /// <summary> |
549 | /// Gets the <see cref="Object"/> at the specified index. | 549 | /// Gets the <see cref="Object"/> at the specified index. |
550 | /// </summary> | 550 | /// </summary> |
551 | /// <value></value> | 551 | /// <value></value> |
552 | public object this[string index] | 552 | public object this[string index] |
553 | { | 553 | { |
554 | get | 554 | get |
555 | { | 555 | { |
556 | if(!m_OptionFields.ContainsKey(index)) | 556 | if(!m_OptionFields.ContainsKey(index)) |
557 | { | 557 | { |
558 | return null; | 558 | return null; |
559 | } | 559 | } |
560 | 560 | ||
561 | FieldInfo f = (FieldInfo)m_OptionFields[index]; | 561 | FieldInfo f = (FieldInfo)m_OptionFields[index]; |
562 | return f.GetValue(this); | 562 | return f.GetValue(this); |
563 | } | 563 | } |
564 | } | 564 | } |
565 | 565 | ||
566 | /// <summary> | 566 | /// <summary> |
567 | /// Gets the <see cref="Object"/> at the specified index. | 567 | /// Gets the <see cref="Object"/> at the specified index. |
568 | /// </summary> | 568 | /// </summary> |
569 | /// <value></value> | 569 | /// <value></value> |
570 | public object this[string index, object defaultValue] | 570 | public object this[string index, object defaultValue] |
571 | { | 571 | { |
572 | get | 572 | get |
573 | { | 573 | { |
574 | object valueObject = this[index]; | 574 | object valueObject = this[index]; |
575 | if(valueObject != null && valueObject is string && ((string)valueObject).Length == 0) | 575 | if(valueObject != null && valueObject is string && ((string)valueObject).Length == 0) |
576 | { | 576 | { |
577 | return defaultValue; | 577 | return defaultValue; |
578 | } | 578 | } |
579 | return valueObject; | 579 | return valueObject; |
580 | } | 580 | } |
581 | } | 581 | } |
582 | 582 | ||
583 | 583 | ||
584 | #endregion | 584 | #endregion |
585 | 585 | ||
586 | #region Private Methods | 586 | #region Private Methods |
587 | 587 | ||
588 | private void FlagDefined(string name) | 588 | private void FlagDefined(string name) |
589 | { | 589 | { |
590 | if(!m_FieldsDefined.Contains(name)) | 590 | if(!m_FieldsDefined.Contains(name)) |
591 | { | 591 | { |
592 | m_FieldsDefined.Add(name); | 592 | m_FieldsDefined.Add(name); |
593 | } | 593 | } |
594 | } | 594 | } |
595 | 595 | ||
596 | private void SetOption(string nodeName, string val) | 596 | private void SetOption(string nodeName, string val) |
597 | { | 597 | { |
598 | lock(m_OptionFields) | 598 | lock(m_OptionFields) |
599 | { | 599 | { |
600 | if(!m_OptionFields.ContainsKey(nodeName)) | 600 | if(!m_OptionFields.ContainsKey(nodeName)) |
601 | { | 601 | { |
602 | return; | 602 | return; |
603 | } | 603 | } |
604 | 604 | ||
605 | FieldInfo f = (FieldInfo)m_OptionFields[nodeName]; | 605 | FieldInfo f = (FieldInfo)m_OptionFields[nodeName]; |
606 | f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); | 606 | f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); |
607 | FlagDefined(f.Name); | 607 | FlagDefined(f.Name); |
608 | } | 608 | } |
609 | } | 609 | } |
610 | 610 | ||
611 | #endregion | 611 | #endregion |
612 | 612 | ||
613 | #region Public Methods | 613 | #region Public Methods |
614 | 614 | ||
615 | /// <summary> | 615 | /// <summary> |
616 | /// Parses the specified node. | 616 | /// Parses the specified node. |
617 | /// </summary> | 617 | /// </summary> |
618 | /// <param name="node">The node.</param> | 618 | /// <param name="node">The node.</param> |
619 | public override void Parse(XmlNode node) | 619 | public override void Parse(XmlNode node) |
620 | { | 620 | { |
621 | if( node == null ) | 621 | if( node == null ) |
622 | { | 622 | { |
623 | throw new ArgumentNullException("node"); | 623 | throw new ArgumentNullException("node"); |
624 | } | 624 | } |
625 | 625 | ||
626 | foreach(XmlNode child in node.ChildNodes) | 626 | foreach(XmlNode child in node.ChildNodes) |
627 | { | 627 | { |
628 | SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText)); | 628 | SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText)); |
629 | } | 629 | } |
630 | } | 630 | } |
631 | 631 | ||
632 | /// <summary> | 632 | /// <summary> |
633 | /// Copies to. | 633 | /// Copies to. |
634 | /// </summary> | 634 | /// </summary> |
635 | /// <param name="opt">The opt.</param> | 635 | /// <param name="opt">The opt.</param> |
636 | public void CopyTo(OptionsNode opt) | 636 | public void CopyTo(OptionsNode opt) |
637 | { | 637 | { |
638 | if(opt == null) | 638 | if(opt == null) |
639 | { | 639 | { |
640 | return; | 640 | return; |
641 | } | 641 | } |
642 | 642 | ||
643 | foreach(FieldInfo f in m_OptionFields.Values) | 643 | foreach(FieldInfo f in m_OptionFields.Values) |
644 | { | 644 | { |
645 | if(m_FieldsDefined.Contains(f.Name)) | 645 | if(m_FieldsDefined.Contains(f.Name)) |
646 | { | 646 | { |
647 | f.SetValue(opt, f.GetValue(this)); | 647 | f.SetValue(opt, f.GetValue(this)); |
648 | opt.m_FieldsDefined.Add(f.Name); | 648 | opt.m_FieldsDefined.Add(f.Name); |
649 | } | 649 | } |
650 | } | 650 | } |
651 | } | 651 | } |
652 | 652 | ||
653 | #endregion | 653 | #endregion |
654 | } | 654 | } |
655 | } | 655 | } |