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