1
Vote

Patch: Parse task elements regardless of their name

description

My task elements are named "task", rather than "Task". The original code barfed and wouldn't pick up that element. This fix assumes that the elements passed to the TaskScheduler constructor represent all task elements:
 
From Line 55:
 
foreach (XmlNode node in this._nodes)
{
if (node.NodeType != XmlNodeType.Element) continue;
try
{
    XmlAttributeCollection attributes = node.Attributes;
 
    if (bool.Parse(attributes["enabled"].Value))
    {
        Task task = new Task(double.Parse(attributes["interval"].Value));
 
        task.Name = attributes["name"].Value;
        task.TaskType = Type.GetType(attributes["type"].Value, true);
        task.Enabled = bool.Parse(attributes["enabled"].Value);
        task.Priority = (Priority)Enum.Parse(typeof(Priority), attributes["priority"].Value);
        task.ConfigurationNode = node;
 
        _tasks.Add(task);
    }
}
catch
{
    // TODO: Log this...
}
}

comments