aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Nodes/SolutionNode.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Nodes/SolutionNode.cs')
-rw-r--r--Prebuild/src/Core/Nodes/SolutionNode.cs358
1 files changed, 0 insertions, 358 deletions
diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs
deleted file mode 100644
index 2a1b8e2..0000000
--- a/Prebuild/src/Core/Nodes/SolutionNode.cs
+++ /dev/null
@@ -1,358 +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.Collections;
28using System.Collections.Generic;
29using System.Diagnostics;
30using System.IO;
31using System.Xml;
32
33using Prebuild.Core.Attributes;
34using Prebuild.Core.Interfaces;
35using Prebuild.Core.Utilities;
36
37namespace Prebuild.Core.Nodes
38{
39 /// <summary>
40 ///
41 /// </summary>
42 [DataNode("Solution")]
43 [DataNode("EmbeddedSolution")]
44 [DebuggerDisplay("{Name}")]
45 public class SolutionNode : DataNode
46 {
47 #region Fields
48
49 private Guid m_Guid = Guid.NewGuid();
50 private string m_Name = "unknown";
51 private string m_Path = "";
52 private string m_FullPath = "";
53 private string m_ActiveConfig = "Debug";
54 private string m_Version = "1.0.0";
55
56 private OptionsNode m_Options;
57 private FilesNode m_Files;
58 private readonly Hashtable m_Configurations = new Hashtable();
59 private readonly Hashtable m_Projects = new Hashtable();
60 private readonly Hashtable m_DatabaseProjects = new Hashtable();
61 private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>();
62 private readonly Hashtable m_Solutions = new Hashtable();
63
64 #endregion
65
66 #region Properties
67 public override IDataNode Parent
68 {
69 get
70 {
71 return base.Parent;
72 }
73 set
74 {
75 if (value is SolutionNode)
76 {
77 SolutionNode solution = (SolutionNode)value;
78 foreach (ConfigurationNode conf in solution.Configurations)
79 {
80 m_Configurations[conf.Name] = conf.Clone();
81 }
82 }
83
84 base.Parent = value;
85 }
86 }
87
88 public Guid Guid
89 {
90 get
91 {
92 return m_Guid;
93 }
94 set
95 {
96 m_Guid = value;
97 }
98 }
99 /// <summary>
100 /// Gets or sets the active config.
101 /// </summary>
102 /// <value>The active config.</value>
103 public string ActiveConfig
104 {
105 get
106 {
107 return m_ActiveConfig;
108 }
109 set
110 {
111 m_ActiveConfig = value;
112 }
113 }
114
115 /// <summary>
116 /// Gets the name.
117 /// </summary>
118 /// <value>The name.</value>
119 public string Name
120 {
121 get
122 {
123 return m_Name;
124 }
125 }
126
127 /// <summary>
128 /// Gets the path.
129 /// </summary>
130 /// <value>The path.</value>
131 public string Path
132 {
133 get
134 {
135 return m_Path;
136 }
137 }
138
139 /// <summary>
140 /// Gets the full path.
141 /// </summary>
142 /// <value>The full path.</value>
143 public string FullPath
144 {
145 get
146 {
147 return m_FullPath;
148 }
149 }
150
151 /// <summary>
152 /// Gets the version.
153 /// </summary>
154 /// <value>The version.</value>
155 public string Version
156 {
157 get
158 {
159 return m_Version;
160 }
161 }
162
163 /// <summary>
164 /// Gets the options.
165 /// </summary>
166 /// <value>The options.</value>
167 public OptionsNode Options
168 {
169 get
170 {
171 return m_Options;
172 }
173 }
174
175 /// <summary>
176 /// Gets the files.
177 /// </summary>
178 /// <value>The files.</value>
179 public FilesNode Files
180 {
181 get
182 {
183 return m_Files;
184 }
185 }
186
187 /// <summary>
188 /// Gets the configurations.
189 /// </summary>
190 /// <value>The configurations.</value>
191 public ICollection Configurations
192 {
193 get
194 {
195 ArrayList tmp = new ArrayList(ConfigurationsTable.Values);
196 tmp.Sort();
197 return tmp;
198 }
199 }
200
201 /// <summary>
202 /// Gets the configurations table.
203 /// </summary>
204 /// <value>The configurations table.</value>
205 public Hashtable ConfigurationsTable
206 {
207 get
208 {
209 return m_Configurations;
210 }
211 }
212 /// <summary>
213 /// Gets the database projects.
214 /// </summary>
215 public ICollection DatabaseProjects
216 {
217 get
218 {
219 return m_DatabaseProjects.Values;
220 }
221 }
222 /// <summary>
223 /// Gets the nested solutions.
224 /// </summary>
225 public ICollection Solutions
226 {
227 get
228 {
229 return m_Solutions.Values;
230 }
231 }
232 /// <summary>
233 /// Gets the nested solutions hash table.
234 /// </summary>
235 public Hashtable SolutionsTable
236 {
237 get
238 {
239 return this.m_Solutions;
240 }
241 }
242 /// <summary>
243 /// Gets the projects.
244 /// </summary>
245 /// <value>The projects.</value>
246 public ICollection Projects
247 {
248 get
249 {
250 ArrayList tmp = new ArrayList(m_Projects.Values);
251 tmp.Sort();
252 return tmp;
253 }
254 }
255
256 /// <summary>
257 /// Gets the projects table.
258 /// </summary>
259 /// <value>The projects table.</value>
260 public Hashtable ProjectsTable
261 {
262 get
263 {
264 return m_Projects;
265 }
266 }
267
268 /// <summary>
269 /// Gets the projects table.
270 /// </summary>
271 /// <value>The projects table.</value>
272 public List<ProjectNode> ProjectsTableOrder
273 {
274 get
275 {
276 return m_ProjectsOrder;
277 }
278 }
279
280 #endregion
281
282 #region Public Methods
283
284 /// <summary>
285 /// Parses the specified node.
286 /// </summary>
287 /// <param name="node">The node.</param>
288 public override void Parse(XmlNode node)
289 {
290 m_Name = Helper.AttributeValue(node, "name", m_Name);
291 m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig);
292 m_Path = Helper.AttributeValue(node, "path", m_Path);
293 m_Version = Helper.AttributeValue(node, "version", m_Version);
294
295 m_FullPath = m_Path;
296 try
297 {
298 m_FullPath = Helper.ResolvePath(m_FullPath);
299 }
300 catch
301 {
302 throw new WarningException("Could not resolve solution path: {0}", m_Path);
303 }
304
305 Kernel.Instance.CurrentWorkingDirectory.Push();
306 try
307 {
308 Helper.SetCurrentDir(m_FullPath);
309
310 if( node == null )
311 {
312 throw new ArgumentNullException("node");
313 }
314
315 foreach(XmlNode child in node.ChildNodes)
316 {
317 IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
318 if(dataNode is OptionsNode)
319 {
320 m_Options = (OptionsNode)dataNode;
321 }
322 else if(dataNode is FilesNode)
323 {
324 m_Files = (FilesNode)dataNode;
325 }
326 else if(dataNode is ConfigurationNode)
327 {
328 m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode;
329 }
330 else if(dataNode is ProjectNode)
331 {
332 m_Projects[((ProjectNode)dataNode).Name] = dataNode;
333 m_ProjectsOrder.Add((ProjectNode)dataNode);
334 }
335 else if(dataNode is SolutionNode)
336 {
337 m_Solutions[((SolutionNode)dataNode).Name] = dataNode;
338 }
339 else if (dataNode is ProcessNode)
340 {
341 ProcessNode p = (ProcessNode)dataNode;
342 Kernel.Instance.ProcessFile(p, this);
343 }
344 else if (dataNode is DatabaseProjectNode)
345 {
346 m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode;
347 }
348 }
349 }
350 finally
351 {
352 Kernel.Instance.CurrentWorkingDirectory.Pop();
353 }
354 }
355
356 #endregion
357 }
358}