internal static StepParameter Parse(string parameter) { var product = new StepParameter { PhaseIndex = 0, StepIndex = 0, PropertyName = string.Empty, Value = string.Empty }; var match = Regex.Match(parameter, ParameterRegex, RegexOptions.IgnoreCase); var segments = new List <string>(match.Value.TrimEnd(':').Split('.')); if (segments[0].StartsWith("PHASE", StringComparison.OrdinalIgnoreCase)) { product.PhaseIndex = int.Parse(segments[0].Substring(5)) - 1; segments.RemoveAt(0); } if (!segments[0].StartsWith("STEP", StringComparison.OrdinalIgnoreCase)) { throw new InvalidStepParameterException("Missing step index"); } product.StepIndex = int.Parse(segments[0].Substring(4)) - 1; if (segments.Count > 1) { product.PropertyName = segments[1]; } if (match.Value.Length < parameter.Length) { product.Value = parameter.Substring(match.Value.Length); } return(product); }
internal ExecutionContext(string packagePath, string targetPath, string[] networkTargets, string sandboxPath, Manifest manifest, int currentPhase, int countOfPhases, string[] parameters, TextWriter console) { this.PackagePath = packagePath; this.TargetPath = targetPath; this.NetworkTargets = networkTargets; this.SandboxPath = sandboxPath; this.Manifest = manifest; this.CurrentPhase = currentPhase; this.CountOfPhases = countOfPhases; this.Console = console; _parameters = parameters == null ? new StepParameter[0] : parameters.Select(p => StepParameter.Parse(p)).ToArray(); }