Example #1
0
        private IOperationOptions GetTypeOptions(string type, CommandOptions options)
        {
            switch (type)
            {
            case "install":
                var installOperationOptions = new InstallOperationOptions();
                installOperationOptions.Inputfilename = "tools.gti";
                if (!string.IsNullOrWhiteSpace(options.InputFilename))
                {
                    installOperationOptions.Inputfilename = options.InputFilename;
                }
                return(installOperationOptions);

            case "save":
                var saveOperationOptions = new SaveOperationOptions();
                saveOperationOptions.Outputfilename = "tools.gti";
                if (!string.IsNullOrWhiteSpace(options.OutputFilename))
                {
                    saveOperationOptions.Outputfilename = options.OutputFilename;
                }

                saveOperationOptions.OutputType = "csv";
                if (!string.IsNullOrWhiteSpace(options.OutputType))
                {
                    saveOperationOptions.OutputType = options.OutputType;
                }
                return(saveOperationOptions);

            default:
                throw new ArgumentOutOfRangeException($"Invalid operation requested {options.Command}, valid operations are [save,install]");
            }
        }
Example #2
0
        public void SetOperationOptions(IOperationOptions options)
        {
            var op = options as SaveOperationOptions;

            if (op == null)
            {
                throw new ArgumentException(nameof(options));
            }
            else
            {
                _options = op;
            }
        }