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