aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Nodes/FilesNode.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Nodes/FilesNode.cs')
-rw-r--r--Prebuild/src/Core/Nodes/FilesNode.cs446
1 files changed, 223 insertions, 223 deletions
diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs
index d31307b..05b2255 100644
--- a/Prebuild/src/Core/Nodes/FilesNode.cs
+++ b/Prebuild/src/Core/Nodes/FilesNode.cs
@@ -1,223 +1,223 @@
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-09-20 09:42:51 +0200 (on, 20 sep 2006) $ 30 * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $
31 * $Revision: 164 $ 31 * $Revision: 164 $
32 */ 32 */
33#endregion 33#endregion
34 34
35using System; 35using System;
36using System.Collections; 36using System.Collections;
37using System.Collections.Specialized; 37using System.Collections.Specialized;
38using System.Xml; 38using System.Xml;
39 39
40using Prebuild.Core.Attributes; 40using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces; 41using Prebuild.Core.Interfaces;
42 42
43namespace Prebuild.Core.Nodes 43namespace Prebuild.Core.Nodes
44{ 44{
45 /// <summary> 45 /// <summary>
46 /// 46 ///
47 /// </summary> 47 /// </summary>
48 [DataNode("Files")] 48 [DataNode("Files")]
49 public class FilesNode : DataNode 49 public class FilesNode : DataNode
50 { 50 {
51 #region Fields 51 #region Fields
52 52
53 private StringCollection m_Files; 53 private StringCollection m_Files;
54 private Hashtable m_BuildActions; 54 private Hashtable m_BuildActions;
55 private Hashtable m_SubTypes; 55 private Hashtable m_SubTypes;
56 private Hashtable m_ResourceNames; 56 private Hashtable m_ResourceNames;
57 private Hashtable m_CopyToOutputs; 57 private Hashtable m_CopyToOutputs;
58 private Hashtable m_Links; 58 private Hashtable m_Links;
59 59
60 60
61 #endregion 61 #endregion
62 62
63 #region Constructors 63 #region Constructors
64 64
65 /// <summary> 65 /// <summary>
66 /// 66 ///
67 /// </summary> 67 /// </summary>
68 public FilesNode() 68 public FilesNode()
69 { 69 {
70 m_Files = new StringCollection(); 70 m_Files = new StringCollection();
71 m_BuildActions = new Hashtable(); 71 m_BuildActions = new Hashtable();
72 m_SubTypes = new Hashtable(); 72 m_SubTypes = new Hashtable();
73 m_ResourceNames = new Hashtable(); 73 m_ResourceNames = new Hashtable();
74 m_CopyToOutputs = new Hashtable(); 74 m_CopyToOutputs = new Hashtable();
75 m_Links = new Hashtable(); 75 m_Links = new Hashtable();
76 } 76 }
77 77
78 #endregion 78 #endregion
79 79
80 #region Properties 80 #region Properties
81 81
82 /// <summary> 82 /// <summary>
83 /// 83 ///
84 /// </summary> 84 /// </summary>
85 public int Count 85 public int Count
86 { 86 {
87 get 87 get
88 { 88 {
89 return m_Files.Count; 89 return m_Files.Count;
90 } 90 }
91 } 91 }
92 92
93 #endregion 93 #endregion
94 94
95 #region Public Methods 95 #region Public Methods
96 96
97 /// <summary> 97 /// <summary>
98 /// 98 ///
99 /// </summary> 99 /// </summary>
100 /// <param name="file"></param> 100 /// <param name="file"></param>
101 /// <returns></returns> 101 /// <returns></returns>
102 public BuildAction GetBuildAction(string file) 102 public BuildAction GetBuildAction(string file)
103 { 103 {
104 if(!m_BuildActions.ContainsKey(file)) 104 if(!m_BuildActions.ContainsKey(file))
105 { 105 {
106 return BuildAction.Compile; 106 return BuildAction.Compile;
107 } 107 }
108 108
109 return (BuildAction)m_BuildActions[file]; 109 return (BuildAction)m_BuildActions[file];
110 } 110 }
111 111
112 public CopyToOutput GetCopyToOutput(string file) 112 public CopyToOutput GetCopyToOutput(string file)
113 { 113 {
114 if (!this.m_CopyToOutputs.ContainsKey(file)) 114 if (!this.m_CopyToOutputs.ContainsKey(file))
115 { 115 {
116 return CopyToOutput.Never; 116 return CopyToOutput.Never;
117 } 117 }
118 return (CopyToOutput) this.m_CopyToOutputs[file]; 118 return (CopyToOutput) this.m_CopyToOutputs[file];
119 } 119 }
120 120
121 public bool GetIsLink(string file) 121 public bool GetIsLink(string file)
122 { 122 {
123 if (!this.m_Links.ContainsKey(file)) 123 if (!this.m_Links.ContainsKey(file))
124 { 124 {
125 return false; 125 return false;
126 } 126 }
127 return (bool) this.m_Links[file]; 127 return (bool) this.m_Links[file];
128 } 128 }
129 129
130 /// <summary> 130 /// <summary>
131 /// 131 ///
132 /// </summary> 132 /// </summary>
133 /// <param name="file"></param> 133 /// <param name="file"></param>
134 /// <returns></returns> 134 /// <returns></returns>
135 public SubType GetSubType(string file) 135 public SubType GetSubType(string file)
136 { 136 {
137 if(!m_SubTypes.ContainsKey(file)) 137 if(!m_SubTypes.ContainsKey(file))
138 { 138 {
139 return SubType.Code; 139 return SubType.Code;
140 } 140 }
141 141
142 return (SubType)m_SubTypes[file]; 142 return (SubType)m_SubTypes[file];
143 } 143 }
144 144
145 /// <summary> 145 /// <summary>
146 /// 146 ///
147 /// </summary> 147 /// </summary>
148 /// <param name="file"></param> 148 /// <param name="file"></param>
149 /// <returns></returns> 149 /// <returns></returns>
150 public string GetResourceName(string file) 150 public string GetResourceName(string file)
151 { 151 {
152 if(!m_ResourceNames.ContainsKey(file)) 152 if(!m_ResourceNames.ContainsKey(file))
153 { 153 {
154 return ""; 154 return "";
155 } 155 }
156 156
157 return (string)m_ResourceNames[file]; 157 return (string)m_ResourceNames[file];
158 } 158 }
159 159
160 /// <summary> 160 /// <summary>
161 /// 161 ///
162 /// </summary> 162 /// </summary>
163 /// <param name="node"></param> 163 /// <param name="node"></param>
164 public override void Parse(XmlNode node) 164 public override void Parse(XmlNode node)
165 { 165 {
166 if( node == null ) 166 if( node == null )
167 { 167 {
168 throw new ArgumentNullException("node"); 168 throw new ArgumentNullException("node");
169 } 169 }
170 foreach(XmlNode child in node.ChildNodes) 170 foreach(XmlNode child in node.ChildNodes)
171 { 171 {
172 IDataNode dataNode = Kernel.Instance.ParseNode(child, this); 172 IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
173 if(dataNode is FileNode) 173 if(dataNode is FileNode)
174 { 174 {
175 FileNode fileNode = (FileNode)dataNode; 175 FileNode fileNode = (FileNode)dataNode;
176 if(fileNode.IsValid) 176 if(fileNode.IsValid)
177 { 177 {
178 if (!m_Files.Contains(fileNode.Path)) 178 if (!m_Files.Contains(fileNode.Path))
179 { 179 {
180 m_Files.Add(fileNode.Path); 180 m_Files.Add(fileNode.Path);
181 m_BuildActions[fileNode.Path] = fileNode.BuildAction; 181 m_BuildActions[fileNode.Path] = fileNode.BuildAction;
182 m_SubTypes[fileNode.Path] = fileNode.SubType; 182 m_SubTypes[fileNode.Path] = fileNode.SubType;
183 m_ResourceNames[fileNode.Path] = fileNode.ResourceName; 183 m_ResourceNames[fileNode.Path] = fileNode.ResourceName;
184 this.m_Links[fileNode.Path] = fileNode.IsLink; 184 this.m_Links[fileNode.Path] = fileNode.IsLink;
185 this.m_CopyToOutputs[fileNode.Path] = fileNode.CopyToOutput; 185 this.m_CopyToOutputs[fileNode.Path] = fileNode.CopyToOutput;
186 186
187 } 187 }
188 } 188 }
189 } 189 }
190 else if(dataNode is MatchNode) 190 else if(dataNode is MatchNode)
191 { 191 {
192 foreach(string file in ((MatchNode)dataNode).Files) 192 foreach(string file in ((MatchNode)dataNode).Files)
193 { 193 {
194 if (!m_Files.Contains(file)) 194 if (!m_Files.Contains(file))
195 { 195 {
196 m_Files.Add(file); 196 m_Files.Add(file);
197 m_BuildActions[file] = ((MatchNode)dataNode).BuildAction; 197 m_BuildActions[file] = ((MatchNode)dataNode).BuildAction;
198 m_SubTypes[file] = ((MatchNode)dataNode).SubType; 198 m_SubTypes[file] = ((MatchNode)dataNode).SubType;
199 m_ResourceNames[file] = ((MatchNode)dataNode).ResourceName; 199 m_ResourceNames[file] = ((MatchNode)dataNode).ResourceName;
200 this.m_Links[file] = ((MatchNode) dataNode).IsLink; 200 this.m_Links[file] = ((MatchNode) dataNode).IsLink;
201 this.m_CopyToOutputs[file] = ((MatchNode) dataNode).CopyToOutput; 201 this.m_CopyToOutputs[file] = ((MatchNode) dataNode).CopyToOutput;
202 202
203 } 203 }
204 } 204 }
205 } 205 }
206 } 206 }
207 } 207 }
208 208
209 // TODO: Check in to why StringCollection's enumerator doesn't implement 209 // TODO: Check in to why StringCollection's enumerator doesn't implement
210 // IEnumerator? 210 // IEnumerator?
211 /// <summary> 211 /// <summary>
212 /// 212 ///
213 /// </summary> 213 /// </summary>
214 /// <returns></returns> 214 /// <returns></returns>
215 public StringEnumerator GetEnumerator() 215 public StringEnumerator GetEnumerator()
216 { 216 {
217 return m_Files.GetEnumerator(); 217 return m_Files.GetEnumerator();
218 } 218 }
219 219
220 #endregion 220 #endregion
221 221
222 } 222 }
223} 223}