aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Targets/ToolInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Targets/ToolInfo.cs')
-rw-r--r--Prebuild/src/Core/Targets/ToolInfo.cs197
1 files changed, 197 insertions, 0 deletions
diff --git a/Prebuild/src/Core/Targets/ToolInfo.cs b/Prebuild/src/Core/Targets/ToolInfo.cs
new file mode 100644
index 0000000..935c674
--- /dev/null
+++ b/Prebuild/src/Core/Targets/ToolInfo.cs
@@ -0,0 +1,197 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace Prebuild.Core.Targets
6{
7 /// <summary>
8 ///
9 /// </summary>
10 public struct ToolInfo
11 {
12 string name;
13 string guid;
14 string fileExtension;
15 string xmlTag;
16 string importProject;
17
18 /// <summary>
19 /// Gets or sets the name.
20 /// </summary>
21 /// <value>The name.</value>
22 public string Name
23 {
24 get
25 {
26 return name;
27 }
28 set
29 {
30 name = value;
31 }
32 }
33
34 /// <summary>
35 /// Gets or sets the GUID.
36 /// </summary>
37 /// <value>The GUID.</value>
38 public string Guid
39 {
40 get
41 {
42 return guid;
43 }
44 set
45 {
46 guid = value;
47 }
48 }
49
50 /// <summary>
51 /// Gets or sets the file extension.
52 /// </summary>
53 /// <value>The file extension.</value>
54 public string FileExtension
55 {
56 get
57 {
58 return fileExtension;
59 }
60 set
61 {
62 fileExtension = value;
63 }
64 }
65 public string LanguageExtension
66 {
67 get
68 {
69 switch (this.Name)
70 {
71 case "C#":
72 return ".cs";
73 case "VisualBasic":
74 return ".vb";
75 case "Boo":
76 return ".boo";
77 default:
78 return ".cs";
79 }
80 }
81 }
82 /// <summary>
83 /// Gets or sets the XML tag.
84 /// </summary>
85 /// <value>The XML tag.</value>
86 public string XmlTag
87 {
88 get
89 {
90 return xmlTag;
91 }
92 set
93 {
94 xmlTag = value;
95 }
96 }
97
98 /// <summary>
99 /// Gets or sets the import project property.
100 /// </summary>
101 /// <value>The ImportProject tag.</value>
102 public string ImportProject
103 {
104 get
105 {
106 return importProject;
107 }
108 set
109 {
110 importProject = value;
111 }
112 }
113
114 /// <summary>
115 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
116 /// </summary>
117 /// <param name="name">The name.</param>
118 /// <param name="guid">The GUID.</param>
119 /// <param name="fileExtension">The file extension.</param>
120 /// <param name="xml">The XML.</param>
121 /// <param name="importProject">The import project.</param>
122 public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
123 {
124 this.name = name;
125 this.guid = guid;
126 this.fileExtension = fileExtension;
127 this.xmlTag = xml;
128 this.importProject = importProject;
129 }
130
131 /// <summary>
132 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
133 /// </summary>
134 /// <param name="name">The name.</param>
135 /// <param name="guid">The GUID.</param>
136 /// <param name="fileExtension">The file extension.</param>
137 /// <param name="xml">The XML.</param>
138 public ToolInfo(string name, string guid, string fileExtension, string xml)
139 {
140 this.name = name;
141 this.guid = guid;
142 this.fileExtension = fileExtension;
143 this.xmlTag = xml;
144 this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
145 }
146
147 /// <summary>
148 /// Equals operator
149 /// </summary>
150 /// <param name="obj">ToolInfo to compare</param>
151 /// <returns>true if toolInfos are equal</returns>
152 public override bool Equals(object obj)
153 {
154 if (obj == null)
155 {
156 throw new ArgumentNullException("obj");
157 }
158 if (obj.GetType() != typeof(ToolInfo))
159 return false;
160
161 ToolInfo c = (ToolInfo)obj;
162 return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
163 }
164
165 /// <summary>
166 /// Equals operator
167 /// </summary>
168 /// <param name="c1">ToolInfo to compare</param>
169 /// <param name="c2">ToolInfo to compare</param>
170 /// <returns>True if toolInfos are equal</returns>
171 public static bool operator ==(ToolInfo c1, ToolInfo c2)
172 {
173 return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
174 }
175
176 /// <summary>
177 /// Not equals operator
178 /// </summary>
179 /// <param name="c1">ToolInfo to compare</param>
180 /// <param name="c2">ToolInfo to compare</param>
181 /// <returns>True if toolInfos are not equal</returns>
182 public static bool operator !=(ToolInfo c1, ToolInfo c2)
183 {
184 return !(c1 == c2);
185 }
186
187 /// <summary>
188 /// Hash Code
189 /// </summary>
190 /// <returns>Hash code</returns>
191 public override int GetHashCode()
192 {
193 return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
194
195 }
196 }
197}