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, 12 insertions, 47 deletions
diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs
index 763e6c3..60ed122 100644
--- a/Prebuild/src/Core/Nodes/DataNode.cs
+++ b/Prebuild/src/Core/Nodes/DataNode.cs
@@ -23,24 +23,31 @@ 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
26using System; 35using System;
27using System.Xml; 36using System.Xml;
28 37
29using Prebuild.Core.Attributes; 38using Prebuild.Core.Attributes;
30using Prebuild.Core.Interfaces; 39using Prebuild.Core.Interfaces;
31using System.IO;
32 40
33namespace Prebuild.Core.Nodes 41namespace Prebuild.Core.Nodes
34{ 42{
35 /// <summary> 43 /// <summary>
36 /// 44 ///
37 /// </summary> 45 /// </summary>
38 public abstract class DataNode : IDataNode 46 public class DataNode : IDataNode
39 { 47 {
40 #region Fields 48 #region Fields
41 49
42 private IDataNode parent; 50 private IDataNode parent;
43 string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" };
44 51
45 #endregion 52 #endregion
46 53
@@ -61,10 +68,7 @@ namespace Prebuild.Core.Nodes
61 parent = value; 68 parent = value;
62 } 69 }
63 } 70 }
64 public string[] WebTypes 71
65 {
66 get { return m_WebTypes; }
67 }
68 /// <summary> 72 /// <summary>
69 /// Parses the specified node. 73 /// Parses the specified node.
70 /// </summary> 74 /// </summary>
@@ -72,46 +76,7 @@ namespace Prebuild.Core.Nodes
72 public virtual void Parse(XmlNode node) 76 public virtual void Parse(XmlNode node)
73 { 77 {
74 } 78 }
75 public BuildAction GetBuildActionByFileName(string fileName) 79
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 }
115 #endregion 80 #endregion
116 } 81 }
117} 82}