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(); } }
/// <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); }