コード例 #1
0
        public ParserGeneric(ISourceTool <T> sourceTool = null, Logger logger = null)
        {
            _logger = logger ?? LogManager.GetCurrentClassLogger();

            _logger.Trace("Entering");

            if (!Assembly.GetCallingAssembly()
                .GetName()
                .Name.EndsWith("Tests", StringComparison.CurrentCultureIgnoreCase))
            {
                throw new InvalidOperationException(
                          "This constructor is for testing only. It will throw an exception if it is called from an assembly which is not named *.Tests.");
            }

            _parsePackageConfigFiles = true;
            _parseAssemblyInfoFiles  = true;
            _parseConfigFiles        = true;

            _overrideSourceTool = sourceTool;

            _performanceConfiguration = new PerformanceConfiguration(
                new ParallelOptions {
                MaxDegreeOfParallelism = 1
            }
                );
        }
コード例 #2
0
        private ISourceTool <T> GetSourceTool()
        {
            ISourceTool <T> output   = null;
            VsTsTool        vsTsTool = null;

            if (_overrideSourceTool != null)
            {
                output = _overrideSourceTool;
            }
            else
            {
                if (_sourceType == SourceType.TfsVc || _sourceType == SourceType.TfsGit)
                {
                    vsTsTool = new VsTsTool(
                        _personalAccessToken,
                        _organization,
                        _projectName,
                        _logger,
                        _performanceConfiguration);
                }

                switch (_sourceType)
                {
                case SourceType.None:
                    break;

                case SourceType.TfsVc:
                    output = (ISourceTool <T>) new VcSourceTool(vsTsTool, _logger, _performanceConfiguration);
                    break;

                case SourceType.TfsGit:
                    output = (ISourceTool <T>) new GitSourceTool(vsTsTool, _logger, _performanceConfiguration);
                    break;

                case SourceType.Filesystem:
                    output = (ISourceTool <T>) new FilesystemSourceTool(_logger, _performanceConfiguration);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            return(output);
        }