using System;
using System.Collections;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.Reflection;
using System.Xml;
ITaskHost hostObject;
Target parentTarget;
XmlElement taskElement;
- Type type;
- // FIXME: implement
internal BuildTask (XmlElement taskElement, Target parentTarget)
{
if (taskElement == null)
public void AddOutputItem (string taskParameter,
string itemName)
{
+ XmlElement element = parentTarget.Project.XmlDocument.CreateElement ("Output", Project.XmlNamespace);
+ taskElement.AppendChild (element);
+
+ if (taskParameter != null)
+ element.SetAttribute ("TaskParameter", taskParameter);
+ if (itemName != null)
+ element.SetAttribute ("ItemName", itemName);
}
[MonoTODO]
public void AddOutputProperty (string taskParameter,
string propertyName)
{
+ XmlElement element = parentTarget.Project.XmlDocument.CreateElement ("Output", Project.XmlNamespace);
+ taskElement.AppendChild (element);
+
+ if (taskParameter != null)
+ element.SetAttribute ("TaskParameter", taskParameter);
+ if (propertyName != null)
+ element.SetAttribute ("PropertyName", propertyName);
}
[MonoTODO]
taskEngine = new TaskEngine (parentTarget.Project);
- taskEngine.Prepare (InitializeTask (), this.taskElement,GetParameters (), this.Type);
+ taskEngine.Prepare (InitializeTask (), this.taskElement, GetParameters (), this.Type);
result = taskEngine.Execute ();
}
- [MonoTODO]
public string[] GetParameterNames ()
{
- int attributesCount = 0;
- ArrayList tempNames = new ArrayList ();
- string[] names;
+ List <string> tempNames = new List <string> ();
foreach (XmlAttribute xmlAttribute in taskElement.Attributes) {
if (xmlAttribute.Name == "Condition")
continue;
tempNames.Add (xmlAttribute.Name);
}
- names = new string [tempNames.Count];
- foreach (string name in tempNames)
- names [attributesCount++] = name;
- return names;
+
+ return tempNames.ToArray ();
}
- [MonoTODO]
public string GetParameterValue (string attributeName)
{
+ if (attributeName == "Condition")
+ throw new ArgumentException ("Condition attribute cannot be accessed using this method.");
+ if (attributeName == "ContinueOnError")
+ throw new ArgumentException ("ContinueOnError attribute cannot be accessed using this method.");
+
return taskElement.GetAttribute (attributeName);
}
- [MonoTODO]
public void SetParameterValue (string parameterName,
string parameterValue)
{
SetParameterValue (parameterName, parameterValue, false);
}
- [MonoTODO]
public void SetParameterValue (string parameterName,
string parameterValue,
bool treatParameterValueAsLiteral)
{
- // FIXME: use expression for parameterValue
- taskElement.SetAttribute (parameterName, parameterValue);
+ if (treatParameterValueAsLiteral)
+ taskElement.SetAttribute (parameterName, Utilities.Escape (parameterValue));
+ else
+ taskElement.SetAttribute (parameterName, parameterValue);
}
private void LogTaskStarted ()
return task;
}
- private IDictionary GetParameters ()
+ private IDictionary <string, string> GetParameters ()
{
- IDictionary parameters = new Hashtable ();
+ Dictionary <string, string> parameters = new Dictionary <string, string> ();
string[] parameterNames = GetParameterNames ();
return parameters;
}
- [MonoTODO]
public string Condition {
get {
return taskElement.GetAttribute ("Condition");
public bool ContinueOnError {
get {
string str = taskElement.GetAttribute ("ContinueOnError");
- if (str == String.Empty) {
+ if (str == String.Empty)
return false;
- } else {
- return Boolean.Parse (str);
+ else {
+ Expression exp = new Expression ();
+ exp.Parse (str);
+ return (bool) exp.ConvertTo (parentTarget.Project, typeof (bool));
}
}
set {