Beispiel #1
0
        private static CommandModel DecodeDataArgument(string data, CommandModel model)
        {
            data = DecodeBase64(data);

            var commands = ParseArguments(data);

            return GetModel(commands);
        }
Beispiel #2
0
        /// <summary>
        /// Obtém o modelo de comandos
        /// </summary>
        /// <param name="args">Argumentos</param>
        /// <returns>Modelo de comando</returns>
        public static CommandModel GetModel(string[] args)
        {
            var model = new CommandModel();

            args.ToList().ForEach(x =>
            {
                var matchCmd = Regex.Match(x.Replace("\"", string.Empty), REGEXCMD, RegexOptions.IgnoreCase);

                if (matchCmd.Success)
                {
                    var name = matchCmd.Groups["name"].Value.ToUpper();
                    var value = matchCmd.Groups["value"].Value;

                    switch (name)
                    {
                        case "DEBUG":
                            model.DebugMode = value == "true";
                            break;
                        case "REPORTNAME":
                            model.ReportName = value;
                            break;
                        case "MSACCESS":
                            model.MsAccess = value;
                            break;
                        case "OUTPUTPDF":
                            model.OutputPdf = value;
                            break;
                        case "FILTER":
                            model.Filter = value;
                            break;
                        case "DATA":
                            model = DecodeDataArgument(value, model);
                            break;
                    }

                    model.Arguments.Add(name, value);
                }

            });

            return model;
        }