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