예제 #1
0
 /// <summary>
 /// Get the source of a path type Step input. Returns null if inputStep is not path type
 /// </summary>
 /// <param name="inputStep"></param>
 /// <returns></returns>
 public static AnyOf <HTTP, S3, ProjectFolder> GetPathSource(this Interface.Io.Inputs.IStep inputStep)
 {
     if (inputStep.IsPathType())
     {
         StepFileInput dummy;
         return(inputStep.GetPropertyValue(nameof(dummy.Source)) as AnyOf <HTTP, S3, ProjectFolder>);
     }
     else
     {
         return(null);
     }
 }
예제 #2
0
        /// <summary>
        /// Get asset path of ProjectFolder type to be downloaded
        /// </summary>
        /// <param name="inputStep"></param>
        /// <returns>return empty if it is not a path type input</returns>
        public static string GetInputPath(this Interface.Io.Inputs.IStep inputStep)
        {
            var value = string.Empty;

            if (inputStep.IsPathType())
            {
                var pathSource = inputStep.GetPathSource();
                if (pathSource.Obj is ProjectFolder file)
                {
                    value = file.Path;
                }
                else
                {
                    throw new System.ArgumentException($"The source of {inputStep.Name} is {pathSource.Obj.GetType()}, which is not supported ProjectFolder type");
                }
            }
            return(value);
        }
예제 #3
0
        /// <summary>
        /// Get user's argument of value type inputs (string, int, double, etc)
        /// </summary>
        /// <param name="inputStep"></param>
        /// <returns>return an empty list if inputStep is a path type, which need to be downloaded</returns>
        public static List <object> GetInputValue(this Interface.Io.Inputs.IStep inputStep)
        {
            var value = new List <object>();

            if (inputStep.IsPathType())
            {
                return(value);
            }

            if (inputStep is StepArrayInput s)
            {
                value.AddRange(s.Value);
            }
            else
            {
                var v = inputStep.GetValue();
                value.Add(v);
            }

            return(value);
        }
예제 #4
0
 public static bool IsValueType(this Interface.Io.Inputs.IStep inputStep)
 {
     return(!inputStep.IsPathType());
 }