Beispiel #1
0
        string _arg_fileExclusionList;//see exclusion list

        public TagDiffCommand(TagDiffCommandOptions opt)
        {
            _arg_src1                  = opt.SourcePath1;
            _arg_src2                  = opt.SourcePath2;
            _arg_customRulesPath       = opt.CustomRulesPath;
            _arg_consoleVerbosityLevel = opt.ConsoleVerbosityLevel ?? "medium";
            _arg_ignoreDefault         = opt.IgnoreDefaultRules;
            _arg_outputFile            = opt.OutputFilePath;
            _arg_test_type_raw         = opt.TestType ?? "Equality";
            _arg_logger                = opt.Log;
            _arg_log_file_path         = opt.LogFilePath;
            _arg_close_log_on_exit     = Utils.CLIExecutionContext ? true : opt.CloseLogOnCommandExit;
            _arg_fileExclusionList     = opt.FilePathExclusions;

            _arg_logger ??= Utils.SetupLogging(opt);
            WriteOnce.Log ??= _arg_logger;

            try
            {
                ConfigureConsoleOutput();
                ConfigureCompareType();
                ConfigSourceToScan();
            }
            catch (Exception e) //group error handling
            {
                WriteOnce.Error(e.Message);
                if (_arg_close_log_on_exit)
                {
                    Utils.Logger  = null;
                    WriteOnce.Log = null;
                }
                throw;
            }
        }
        public TagDiffCommand(TagDiffCommandOptions opt)
        {
            _arg_src1                  = opt.SourcePath1;
            _arg_src2                  = opt.SourcePath2;
            _arg_customRulesPath       = opt.CustomRulesPath;
            _arg_consoleVerbosityLevel = opt.ConsoleVerbosityLevel ?? "medium";

            _arg_ignoreDefault = opt.IgnoreDefaultRules;
            opt.TestType ??= "equality";
            _arg_outputFile = opt.OutputFilePath;
            _arg_logger     = opt.Log;


            WriteOnce.ConsoleVerbosity verbosity = WriteOnce.ConsoleVerbosity.Medium;
            if (!Enum.TryParse(_arg_consoleVerbosityLevel, true, out verbosity))
            {
                throw new OpException(String.Format(ErrMsg.FormatString(ErrMsg.ID.CMD_INVALID_ARG_VALUE, "-x")));
            }
            WriteOnce.Verbosity = verbosity;

            if (!Enum.TryParse(opt.TestType, true, out _arg_tagTestType))
            {
                throw new OpException(ErrMsg.FormatString(ErrMsg.ID.CMD_INVALID_ARG_VALUE, opt.TestType));
            }
        }