mirror of
https://github.com/winsw/winsw.git
synced 2025-12-10 18:37:28 +08:00
Added priority support
Also improved the test harness a bit.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user