Exemple #1
0
 ///////////////////////////////////////////////////////////////////////
 private static void LoadCondition(XmlNode node, Task task)
 {
     Condition cond = Condition.Load(node);
     if (cond != null) {
         task.Condition = cond;
         task._nextTime = cond.NextTime;
     }
 }
Exemple #2
0
        ///////////////////////////////////////////////////////////////////////
        // this method assumes the node passed the schema validator
        public static Task Load(XmlNode node)
        {
            if (node.Name != "task") {
                return null;
            }

            Task task = new Task();

            // XXX this approach feels a bit brute-force...  not very elegant
            foreach (XmlNode child in node.ChildNodes) {
                if (child.Name == "condition") {
                    LoadCondition(child, task);
                } else if (child.Name == "commands") {
                    LoadCommands(child, task);
                }
            }

            return task;
        }
Exemple #3
0
        ///////////////////////////////////////////////////////////////////////
        private static void LoadCommands(XmlNode node, Task task)
        {
            foreach (XmlNode child in node.ChildNodes) {
                if (child.Name == "exec") {
                    Command cmd = new Command(child.InnerText);
                    task.Commands.Add(cmd);
                }

                // XXX will we support other kinds of commands?
            }
        }