Added priority support

Also improved the test harness a bit.
This commit is contained in:
Kohsuke Kawaguchi
2014-01-08 22:30:17 -08:00
parent 7359e59e81
commit a4ee776bcc
4 changed files with 53 additions and 22 deletions

View File

@@ -72,6 +72,21 @@ namespace winsw
dom.Load(BasePath + ".xml");
}
/// <summary>
/// Loads descriptor from existing DOM
/// </summary>
public ServiceDescriptor(XmlDocument dom)
{
this.dom = dom;
}
public static ServiceDescriptor FromXML(string xml)
{
var dom = new XmlDocument();
dom.LoadXml(xml);
return new ServiceDescriptor(dom);
}
private string SingleElement(string tagName)
{
return SingleElement(tagName, false);
@@ -571,5 +586,19 @@ namespace winsw
return SingleTimeSpanElement(dom, "stoptimeout", TimeSpan.FromSeconds(15));
}
}
/// <summary>
/// Desired process priority or null if not specified.
/// </summary>
public ProcessPriorityClass Priority
{
get
{
var p = SingleElement("priority",true);
if (p == null) return ProcessPriorityClass.Normal; // default value
return (ProcessPriorityClass)Enum.Parse(typeof(ProcessPriorityClass), p, true);
}
}
}
}