示例#1
0
        public ExecutableCondition(XElement xe, ExecutableContainer container, int indent)
            : base(xe, container, indent)
        {
            var xaValue = xe.Attribute("Value");

            if (xaValue != null)
            {
                this.Value        = container.ParseParameters(xaValue.Value);
                this.ValueOrg     = this.Value;
                this.IsMethodCall = this.Value.StartsWith("#");
            }

            var xeEquales = xe.Attribute("Equals");

            if (xeEquales != null)
            {
                this.EqualsValue = container.ParseParameters(xeEquales.Value);
            }

            // Wenn die Condition nicht stimmt, dann die ActionList leeren, damit auch nichts ausgeführt wird.
            // Bei Methoden (starten mit '#') gilt das nicht, da der Auswertungszeitpunkt erst zur Ausführung
            // der Aktion ist.
            if (this.Value != this.EqualsValue && !this.Value.StartsWith("#"))
            {
                this.ActionList.Clear();
            }
        }
示例#2
0
        /// <summary>
        /// Liest die Argumente ein.
        /// </summary>
        /// <param name="xe"></param>
        /// <returns></returns>
        protected static string ParseArgs(XElement xe, ExecutableContainer container)
        {
            string args = null;

            var attrArgs = xe.Attribute("Args");

            if (attrArgs != null)
            {
                args = container.ParseParameters(attrArgs.Value);
            }

            var xeArgs = xe.Element("Args");

            if (xeArgs != null)
            {
                var elementArgs = FSUtils.EscapeCommandLineArgs(xeArgs.Elements("Arg")
                                                                .Select(xeArg => container.ParseParameters(xeArg.Value)));
                if (!string.IsNullOrWhiteSpace(elementArgs))
                {
                    if (!string.IsNullOrWhiteSpace(args))
                    {
                        args += " " + elementArgs;
                    }
                    else
                    {
                        args = elementArgs;
                    }
                }
            }

            return(args);
        }
示例#3
0
文件: Executable.cs 项目: gehdan/PBE
        public static Executable Create(XElement xe, ExecutableContainer container, int indent)
        {
            switch (xe.Name.LocalName)
            {
            case "Sequence":
                return(new ExecutableSequence(xe, container, indent));

            case "Condition":
                return(new ExecutableCondition(xe, container, indent));

            case "Parallel":
                return(new ExecutableParallel(xe, container, indent));

            case "FSConsole":
                return(new Actions.FSConsole(xe, container, indent));

            case "MD":
                return(new Actions.MakeDir(xe, container, indent));

            case "RD":
                return(new Actions.RemoveDir(xe, container, indent));

            case "CompileRun":
                return(new Actions.CompileRun(xe, container, indent));

            case "Export":
                return(new Actions.Export(xe, container, indent));

            case Actions.ApprovedExport.TypeName:
                return(new Actions.ApprovedExport(xe, container, indent));

            case "Import":
                return(new Actions.Import(xe, container, indent));

            case Actions.ApprovedImport.TypeName:
                return(new Actions.ApprovedImport(xe, container, indent));

            case Actions.ImportQueue.TypeName:
                return(new Actions.ImportQueue(xe, container, indent));

            case "Publish":
                return(new Actions.Publish(xe, container, indent));

            case "Publish2Go":
                return(new Actions.Publish2Go(xe, container, indent));

            case "Publish4Cloud":
                return(new Actions.Publish4Cloud(xe, container, indent));

            case "ExportDoc":
                return(new Actions.ExportDoc(xe, container, indent));

            case "Batch":
                return(new Actions.Batch(xe, container, indent));
            }

            return(null);
        }
示例#4
0
        public Executable(XElement xe, ExecutableContainer container, int indent)
        {
            this.Taskid = System.Threading.Interlocked.Increment(ref TaskCounter);

            this.Indent = indent;
            var attrName = xe.Attribute("Name");

            if (attrName != null)
            {
                this.Name = attrName.Value;
            }
            this.Container = container;
        }
示例#5
0
        public ExecutableParallel(XElement xe, ExecutableContainer container, int indent)
            : base(xe, container, indent)
        {
            var attrMaxTasks = xe.Attribute("MaxTasks");

            if (attrMaxTasks != null)
            {
                int maxTasks;
                if (Int32.TryParse(attrMaxTasks.Value, out maxTasks))
                {
                    this.MaxTasks = maxTasks;
                }
            }

            this.ActionList = xe.Elements().Select(xeSub => Executable.Create(xeSub, container, indent + 1)).ToList();
        }
示例#6
0
 public ExecutableSequence(XElement xe, ExecutableContainer container, int indent)
     : base(xe, container, indent)
 {
     this.ActionList = xe.Elements().Select(xeSub => Executable.Create(xeSub, container, indent + 1)).ToList();
 }