Beispiel #1
0
        private static Func <string, string> CreateFunctionBasedOn(string parameter)
        {
            if (string.IsNullOrWhiteSpace(parameter))
            {
                return(NoTransform);
            }
            var splitParameters = parameter.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            if (splitParameters.Length == 0)
            {
                return(NoTransform);
            }

            var allFuncs = new List <Func <string, string> >(splitParameters.Length);

            foreach (var potentialParameter in splitParameters)
            {
                var function = CreateIndividualTransform(potentialParameter);
                if (function != null)
                {
                    allFuncs.Add(function);
                }
            }

            if (allFuncs.Count == 0)
            {
                return(NoTransform);
            }
            else if (allFuncs.Count == 1)
            {
                return(allFuncs[0]);
            }
            return(MultipleTransform.GetTransform(allFuncs));
        }
Beispiel #2
0
            public static Func <string, string> GetTransform(List <Func <string, string> > transforms)
            {
                MultipleTransform transform = new MultipleTransform(transforms);

                return(transform.Transform);
            }