コード例 #1
0
        public ITask XmlNodeToTasks(XmlNode taskNode, out ArgAutoBingdingEnvironment argAutoBingdingEnvironment)
        {
            argAutoBingdingEnvironment = null;
            if (taskNode.Name.ToUpper() != "TASK" || taskNode.ChildNodes.Count == 0)
            {
                return(null);
            }
            Task task = new Task();

            task.Name = XMLNodeHelper.NodeAtt2String(taskNode, "name");
            task.IsCanIntercurrent = XMLNodeHelper.NodeAtt2Bool(taskNode, "isCanIntercurrent", task.IsCanIntercurrent);
            List <ActionArgCollection> ActionArgCollections = new List <ActionArgCollection>();

            foreach (XmlNode child in taskNode.ChildNodes)
            {
                if (child.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }
                if (child.Name.ToUpper() == "ACTION")
                {
                    ActionArgCollection actionArgCollection = ParseXMLNodeToAction(child, task);
                    if (actionArgCollection != null)
                    {
                        ActionArgCollections.Add(actionArgCollection);
                    }
                }
            }
            argAutoBingdingEnvironment = new ArgAutoBingdingEnvironment(ActionArgCollections.ToArray());
            return(task);
        }
コード例 #2
0
        private ITask ParseTaskScript(out ArgAutoBingdingEnvironment argAutoBingdingEnvironment)
        {
            argAutoBingdingEnvironment = null;
            XmlNode taskNode = _rootNode.SelectSingleNode("Task");

            if (taskNode == null)
            {
                return(null);
            }
            return(new TaskNodeHandler(_assembliesFindDirs).XmlNodeToTasks(taskNode, out argAutoBingdingEnvironment));
        }
コード例 #3
0
 public ITask FromTaskScriptFile(string xmlScriptFielanem, out ArgAutoBingdingEnvironment argAutoBingdingEnvironment)
 {
     argAutoBingdingEnvironment = null;
     try
     {
         OpenTaskScript(xmlScriptFielanem);
         return(ParseTaskScript(out argAutoBingdingEnvironment));
     }
     catch (Exception ex)
     {
         Log.WriterError("TaskNodeHandler", "FromTaskScriptFile", ex.Message);
         return(null);
     }
 }
コード例 #4
0
ファイル: ScriptLoader.cs プロジェクト: configare/hispeed
        public static void LoadFrom(string[] assemblyDirs, string scriptfilename, out List <ActionElement> elements, out List <ActionElementLink> links)
        {
            elements = null;
            links    = null;
            using (TaskScriptParser parser = new TaskScriptParser(assemblyDirs))
            {
                ArgAutoBingdingEnvironment env = null;
                parser.FromTaskScriptFile(scriptfilename, out env);
                if (env == null || env.ActionArgSettings == null || env.ActionArgSettings.Length == 0)
                {
                    throw new Exception("脚本文件\"" + scriptfilename + "\"为空。");
                }
                Dictionary <int, ActionElement>            eles     = new Dictionary <int, ActionElement>();
                Dictionary <LinkObject, ActionElementLink> linkObjs = new Dictionary <LinkObject, ActionElementLink>();
                foreach (ActionArgCollection action in env.ActionArgSettings)
                {
                    ActionElement ele = GetActionElement(action);
                    eles.Add(action.Id, ele);
                    //
                    foreach (ActionArg arg in action.ActionArgs)
                    {
                        switch (arg.ArgType)
                        {
                        case enumArgType.Value:
                            break;

                        case enumArgType.Var:
                            break;

                        case enumArgType.Ref:
                            LinkObject lnkObj = GetLinkObject(linkObjs, action.Id, arg.RefActionId);
                            if (lnkObj != null)     //添加一条函数映射关系
                            {
                            }
                            else
                            {
                                ActionElement     refActionElement = GetActionElement(arg.RefActionId, eles);
                                ActionElementLink actionLnk        = new ActionElementLink(refActionElement, ele);
                                linkObjs.Add(new LinkObject(action.Id, arg.RefActionId), actionLnk);
                            }
                            break;
                        }
                    }
                }
                elements = new List <ActionElement>(eles.Values.ToArray());
                links    = new List <ActionElementLink>(linkObjs.Values.ToArray());
            }
        }
コード例 #5
0
ファイル: TaskActivator.cs プロジェクト: configare/hispeed
 public ITask AddTask(string scriptfilename, IVarProvider varProvider, bool isLoopExecute)
 {
     using (TaskScriptParser parser = new TaskScriptParser(_assemblySearchDirs))
     {
         ArgAutoBingdingEnvironment env = null;
         ITask task = parser.FromTaskScriptFile(scriptfilename, out env);
         if (task != null)
         {
             (task as Task).SetArgAutoBingdingEnvironment(env);
             (task as Task).IsLoopExecute = isLoopExecute;
             (task as Task).SetVarProvider(varProvider);
             (task as Task).SetLog(_log);
             (task as Task).SetTracker(_tracker);
             if (_taskes == null)
             {
                 _taskes = new List <ITask>();
             }
             _taskes.Add(task);
             return(task);
         }
     }
     return(null);
 }
コード例 #6
0
ファイル: Task.cs プロジェクト: configare/hispeed
 internal void SetArgAutoBingdingEnvironment(ArgAutoBingdingEnvironment argAutoBingdingEnvironment)
 {
     _argAutoBingdingEnvironment = argAutoBingdingEnvironment;
 }