Example #1
0
        internal TaskStepProperties MergeWith(TaskStepProperties props)
        {
            var ret = new TaskStepProperties(ExtendedProperties);

            ret.WorkingDirectory = WorkingDirectory ?? props.WorkingDirectory;
            ret.CreateWindow     = CreateWindow ?? props.CreateWindow;
            ret.CaptureOutput    = CaptureOutput ?? props.CaptureOutput;
            ret.ShellExecute     = ShellExecute ?? props.ShellExecute;

            foreach (var kv in props.ExtendedProperties)
            {
                if (ExtendedProperties.ContainsKey(kv.Key))
                {
                    ret.ExtendedProperties.Add(kv.Key, kv.Value);
                }
            }

            return(ret);
        }
Example #2
0
        private TaskStepProperties ReadProperties(Dictionary <string, object> dict)
        {
            var props = new TaskStepProperties();

            foreach (var kv in dict)
            {
                switch (kv.Key)
                {
                case "name":
                case "command":
                case "arguments":
                case "variables":
                    break;

                case "workingDirectory":
                    props.WorkingDirectory = (kv.Value ?? "").ToString();
                    break;

                case "captureOutput":
                    props.CaptureOutput = kv.Value is bool?(bool)kv.Value : false;
                    break;

                case "shellExecute":
                    props.ShellExecute = kv.Value is bool?(bool)kv.Value : false;
                    break;

                case "createWindow":
                    props.CreateWindow = kv.Value is bool?(bool)kv.Value : false;
                    break;

                default:
                    if (kv.Value != null && !props.ExtendedProperties.ContainsKey(kv.Key))
                    {
                        props.ExtendedProperties.Add(kv.Key, kv.Value);
                    }
                    break;
                }
            }

            return(props);
        }