aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Nodes/ConfigurationNode.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Nodes/ConfigurationNode.cs')
-rw-r--r--Prebuild/src/Core/Nodes/ConfigurationNode.cs374
1 files changed, 187 insertions, 187 deletions
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
index 390794f..d2a5d20 100644
--- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs
+++ b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
@@ -1,187 +1,187 @@
1#region BSD License 1#region BSD License
2/* 2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) 3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4 4
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
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22IN 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: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ 30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
34 34
35using System; 35using System;
36using System.Xml; 36using System.Xml;
37 37
38using Prebuild.Core.Attributes; 38using Prebuild.Core.Attributes;
39using Prebuild.Core.Interfaces; 39using Prebuild.Core.Interfaces;
40using Prebuild.Core.Utilities; 40using Prebuild.Core.Utilities;
41 41
42namespace Prebuild.Core.Nodes 42namespace Prebuild.Core.Nodes
43{ 43{
44 /// <summary> 44 /// <summary>
45 /// 45 ///
46 /// </summary> 46 /// </summary>
47 [DataNode("Configuration")] 47 [DataNode("Configuration")]
48 public class ConfigurationNode : DataNode, ICloneable, IComparable 48 public class ConfigurationNode : DataNode, ICloneable, IComparable
49 { 49 {
50 #region Fields 50 #region Fields
51 51
52 private string m_Name = "unknown"; 52 private string m_Name = "unknown";
53 private OptionsNode m_Options; 53 private OptionsNode m_Options;
54 54
55 #endregion 55 #endregion
56 56
57 #region Constructors 57 #region Constructors
58 58
59 /// <summary> 59 /// <summary>
60 /// Initializes a new instance of the <see cref="ConfigurationNode"/> class. 60 /// Initializes a new instance of the <see cref="ConfigurationNode"/> class.
61 /// </summary> 61 /// </summary>
62 public ConfigurationNode() 62 public ConfigurationNode()
63 { 63 {
64 m_Options = new OptionsNode(); 64 m_Options = new OptionsNode();
65 } 65 }
66 66
67 #endregion 67 #endregion
68 68
69 #region Properties 69 #region Properties
70 70
71 /// <summary> 71 /// <summary>
72 /// Gets or sets the parent. 72 /// Gets or sets the parent.
73 /// </summary> 73 /// </summary>
74 /// <value>The parent.</value> 74 /// <value>The parent.</value>
75 public override IDataNode Parent 75 public override IDataNode Parent
76 { 76 {
77 get 77 get
78 { 78 {
79 return base.Parent; 79 return base.Parent;
80 } 80 }
81 set 81 set
82 { 82 {
83 base.Parent = value; 83 base.Parent = value;
84 if(base.Parent is SolutionNode) 84 if(base.Parent is SolutionNode)
85 { 85 {
86 SolutionNode node = (SolutionNode)base.Parent; 86 SolutionNode node = (SolutionNode)base.Parent;
87 if(node != null && node.Options != null) 87 if(node != null && node.Options != null)
88 { 88 {
89 node.Options.CopyTo(m_Options); 89 node.Options.CopyTo(m_Options);
90 } 90 }
91 } 91 }
92 } 92 }
93 } 93 }
94 94
95 /// <summary> 95 /// <summary>
96 /// Gets the name. 96 /// Gets the name.
97 /// </summary> 97 /// </summary>
98 /// <value>The name.</value> 98 /// <value>The name.</value>
99 public string Name 99 public string Name
100 { 100 {
101 get 101 get
102 { 102 {
103 return m_Name; 103 return m_Name;
104 } 104 }
105 } 105 }
106 106
107 /// <summary> 107 /// <summary>
108 /// Gets or sets the options. 108 /// Gets or sets the options.
109 /// </summary> 109 /// </summary>
110 /// <value>The options.</value> 110 /// <value>The options.</value>
111 public OptionsNode Options 111 public OptionsNode Options
112 { 112 {
113 get 113 get
114 { 114 {
115 return m_Options; 115 return m_Options;
116 } 116 }
117 set 117 set
118 { 118 {
119 m_Options = value; 119 m_Options = value;
120 } 120 }
121 } 121 }
122 122
123 #endregion 123 #endregion
124 124
125 #region Public Methods 125 #region Public Methods
126 126
127 /// <summary> 127 /// <summary>
128 /// Parses the specified node. 128 /// Parses the specified node.
129 /// </summary> 129 /// </summary>
130 /// <param name="node">The node.</param> 130 /// <param name="node">The node.</param>
131 public override void Parse(XmlNode node) 131 public override void Parse(XmlNode node)
132 { 132 {
133 m_Name = Helper.AttributeValue(node, "name", m_Name); 133 m_Name = Helper.AttributeValue(node, "name", m_Name);
134 if( node == null ) 134 if( node == null )
135 { 135 {
136 throw new ArgumentNullException("node"); 136 throw new ArgumentNullException("node");
137 } 137 }
138 foreach(XmlNode child in node.ChildNodes) 138 foreach(XmlNode child in node.ChildNodes)
139 { 139 {
140 IDataNode dataNode = Kernel.Instance.ParseNode(child, this); 140 IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
141 if(dataNode is OptionsNode) 141 if(dataNode is OptionsNode)
142 { 142 {
143 ((OptionsNode)dataNode).CopyTo(m_Options); 143 ((OptionsNode)dataNode).CopyTo(m_Options);
144 } 144 }
145 } 145 }
146 } 146 }
147 147
148 /// <summary> 148 /// <summary>
149 /// Copies to. 149 /// Copies to.
150 /// </summary> 150 /// </summary>
151 /// <param name="conf">The conf.</param> 151 /// <param name="conf">The conf.</param>
152 public void CopyTo(ConfigurationNode conf) 152 public void CopyTo(ConfigurationNode conf)
153 { 153 {
154 m_Options.CopyTo(conf.m_Options); 154 m_Options.CopyTo(conf.m_Options);
155 } 155 }
156 156
157 #endregion 157 #endregion
158 158
159 #region ICloneable Members 159 #region ICloneable Members
160 160
161 /// <summary> 161 /// <summary>
162 /// Creates a new object that is a copy of the current instance. 162 /// Creates a new object that is a copy of the current instance.
163 /// </summary> 163 /// </summary>
164 /// <returns> 164 /// <returns>
165 /// A new object that is a copy of this instance. 165 /// A new object that is a copy of this instance.
166 /// </returns> 166 /// </returns>
167 public object Clone() 167 public object Clone()
168 { 168 {
169 ConfigurationNode ret = new ConfigurationNode(); 169 ConfigurationNode ret = new ConfigurationNode();
170 ret.m_Name = m_Name; 170 ret.m_Name = m_Name;
171 m_Options.CopyTo(ret.m_Options); 171 m_Options.CopyTo(ret.m_Options);
172 return ret; 172 return ret;
173 } 173 }
174 174
175 #endregion 175 #endregion
176 176
177 #region IComparable Members 177 #region IComparable Members
178 178
179 public int CompareTo(object obj) 179 public int CompareTo(object obj)
180 { 180 {
181 ConfigurationNode that = (ConfigurationNode) obj; 181 ConfigurationNode that = (ConfigurationNode) obj;
182 return this.m_Name.CompareTo(that.m_Name); 182 return this.m_Name.CompareTo(that.m_Name);
183 } 183 }
184 184
185 #endregion 185 #endregion
186 } 186 }
187} 187}