aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Nodes/DataNode.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Nodes/DataNode.cs')
-rw-r--r--Prebuild/src/Core/Nodes/DataNode.cs59
1 files changed, 47 insertions, 12 deletions
diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs
index 60ed122..763e6c3 100644
--- a/Prebuild/src/Core/Nodes/DataNode.cs
+++ b/Prebuild/src/Core/Nodes/DataNode.cs
@@ -23,31 +23,24 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System; 26using System;
36using System.Xml; 27using System.Xml;
37 28
38using Prebuild.Core.Attributes; 29using Prebuild.Core.Attributes;
39using Prebuild.Core.Interfaces; 30using Prebuild.Core.Interfaces;
31using System.IO;
40 32
41namespace Prebuild.Core.Nodes 33namespace Prebuild.Core.Nodes
42{ 34{
43 /// <summary> 35 /// <summary>
44 /// 36 ///
45 /// </summary> 37 /// </summary>
46 public class DataNode : IDataNode 38 public abstract class DataNode : IDataNode
47 { 39 {
48 #region Fields 40 #region Fields
49 41
50 private IDataNode parent; 42 private IDataNode parent;
43 string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" };
51 44
52 #endregion 45 #endregion
53 46
@@ -68,7 +61,10 @@ namespace Prebuild.Core.Nodes
68 parent = value; 61 parent = value;
69 } 62 }
70 } 63 }
71 64 public string[] WebTypes
65 {
66 get { return m_WebTypes; }
67 }
72 /// <summary> 68 /// <summary>
73 /// Parses the specified node. 69 /// Parses the specified node.
74 /// </summary> 70 /// </summary>
@@ -76,7 +72,46 @@ namespace Prebuild.Core.Nodes
76 public virtual void Parse(XmlNode node) 72 public virtual void Parse(XmlNode node)
77 { 73 {
78 } 74 }
79 75 public BuildAction GetBuildActionByFileName(string fileName)
76 {
77 string extension = Path.GetExtension(fileName).ToLower();
78 foreach (string type in WebTypes)
79 {
80 if (extension == type)
81 return BuildAction.Content;
82 }
83 return BuildAction.Compile;
84 }
85 /// <summary>
86 /// Parses the file type to figure out what type it is
87 /// </summary>
88 /// <returns></returns>
89 public SubType GetSubTypeByFileName(string fileName)
90 {
91 string extension = System.IO.Path.GetExtension(fileName).ToLower();
92 string designer = String.Format(".designer{0}", extension);
93 string path = fileName.ToLower();
94 if (extension == ".resx")
95 {
96 return SubType.Designer;
97 }
98 else if (path.EndsWith(".settings"))
99 {
100 return SubType.Settings;
101 }
102 else
103 {
104
105 foreach (string type in WebTypes)
106 {
107 if (path.EndsWith(string.Format("{0}{1}", type, extension)))
108 {
109 return SubType.CodeBehind;
110 }
111 }
112 }
113 return SubType.Code;
114 }
80 #endregion 115 #endregion
81 } 116 }
82} 117}