private List <Action> GetV1Actions() { List <Action> ret = new List <Action>(); if (v1Task != null && v1Task.GetDataItem("ActionType") != "EMPTY") { var exec = new ExecAction(v1Task); var items = exec.ParsePowerShellItems(); if (items != null) { if (items.Length == 2 && items[0] == "MULTIPLE") { PowerShellConversion |= PowerShellActionPlatformOption.Version1; var mc = System.Text.RegularExpressions.Regex.Matches(items[1], @"<# (?<id>\w+):(?<t>\w+) #>\s*(?<c>[^<#]*)\s*"); foreach (System.Text.RegularExpressions.Match ms in mc) { var a = Action.ActionFromScript(ms.Groups["t"].Value, ms.Groups["c"].Value); if (a != null) { if (ms.Groups["id"].Value != "NO_ID") { a.Id = ms.Groups["id"].Value; } ret.Add(a); } } } else { ret.Add(ExecAction.ConvertFromPowerShellAction(exec)); } } else if (!string.IsNullOrEmpty(exec.Path)) { ret.Add(exec); } } return(ret); }
internal ActionCollection([NotNull] V1Interop.ITask task) { v1Task = task; v1Actions = GetV1Actions(); PowerShellConversion = Action.TryParse(v1Task.GetDataItem(nameof(PowerShellConversion)), psConvert | PowerShellActionPlatformOption.Version2); }