Ejemplo n.º 1
0
        public static String Parse(String argumentString, List <RegexArguments> expressions)
        {
            String args = argumentString;

            if (expressions != null)
            {
                foreach (RegexArguments replacement in expressions)
                {
                    String replaceWith = replacement.ReplaceWith;
                    Regex  regex       = new Regex(replacement.Find);

                    if (replaceWith == null)
                    {
                        args = regex.Replace(args, "");
                    }
                    else
                    {
                        if (replacement.Encoding == EncodingType.Base64)
                        {
                            replaceWith = HandlerUtils.Base64Encode(replaceWith);
                        }

                        args = regex.Replace(args, replaceWith);
                    }
                }
            }

            return(args);
        }
        public static Dictionary <string, string> GatherVariables(HandlerRuntimeBase handler, HandlerStartInfo startInfo)
        {
            Dictionary <string, string> vars = new Dictionary <string, string>();

            vars.Add("INSTANCEID", startInfo.PlanInstanceId.ToString());
            vars.Add("ACTIONINSTANCEID", startInfo.InstanceId.ToString());
            vars.Add("PLANINSTANCEID", startInfo.PlanInstanceId.ToString());
            vars.Add("ISDRYRUN", startInfo.IsDryRun.ToString());
            String parentExitData = startInfo.ParentExitData?.ToString();

            vars.Add("PARENTEXITDATA", HandlerUtils.Base64Encode(parentExitData));
            vars.Add("REQUESTNUMBER", startInfo.RequestNumber);
            vars.Add("REQUESTUSER", startInfo.RequestUser);
            vars.Add("ACTIONNAME", handler.ActionName);
            vars.Add("RUNTIMETYPE", handler.RuntimeType);

            return(vars);
        }