using System;
using System.Collections.Generic;
using System.Text;
namespace Prebuild.Core.Targets
{
///
///
///
public struct ToolInfo
{
string name;
string guid;
string fileExtension;
string xmlTag;
string importProject;
///
/// Gets or sets the name.
///
/// The name.
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
///
/// Gets or sets the GUID.
///
/// The GUID.
public string Guid
{
get
{
return guid;
}
set
{
guid = value;
}
}
///
/// Gets or sets the file extension.
///
/// The file extension.
public string FileExtension
{
get
{
return fileExtension;
}
set
{
fileExtension = value;
}
}
public string LanguageExtension
{
get
{
switch (this.Name)
{
case "C#":
return ".cs";
case "VisualBasic":
return ".vb";
case "Boo":
return ".boo";
default:
return ".cs";
}
}
}
///
/// Gets or sets the XML tag.
///
/// The XML tag.
public string XmlTag
{
get
{
return xmlTag;
}
set
{
xmlTag = value;
}
}
///
/// Gets or sets the import project property.
///
/// The ImportProject tag.
public string ImportProject
{
get
{
return importProject;
}
set
{
importProject = value;
}
}
///
/// Initializes a new instance of the class.
///
/// The name.
/// The GUID.
/// The file extension.
/// The XML.
/// The import project.
public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
{
this.name = name;
this.guid = guid;
this.fileExtension = fileExtension;
this.xmlTag = xml;
this.importProject = importProject;
}
///
/// Initializes a new instance of the class.
///
/// The name.
/// The GUID.
/// The file extension.
/// The XML.
public ToolInfo(string name, string guid, string fileExtension, string xml)
{
this.name = name;
this.guid = guid;
this.fileExtension = fileExtension;
this.xmlTag = xml;
this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
}
///
/// Equals operator
///
/// ToolInfo to compare
/// true if toolInfos are equal
public override bool Equals(object obj)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (obj.GetType() != typeof(ToolInfo))
return false;
ToolInfo c = (ToolInfo)obj;
return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
}
///
/// Equals operator
///
/// ToolInfo to compare
/// ToolInfo to compare
/// True if toolInfos are equal
public static bool operator ==(ToolInfo c1, ToolInfo c2)
{
return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
}
///
/// Not equals operator
///
/// ToolInfo to compare
/// ToolInfo to compare
/// True if toolInfos are not equal
public static bool operator !=(ToolInfo c1, ToolInfo c2)
{
return !(c1 == c2);
}
///
/// Hash Code
///
/// Hash code
public override int GetHashCode()
{
return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
}
}
}