/// <summary>
        /// Initializes a new instance of the <see cref="RepositoryManager"/> class.
        /// </summary>
        /// <param name="repositoryConfig">The repository.config file to parse.</param>
        /// <param name="repositoryEnumerator">The repository enumerator.</param>
        /// <param name="fileSystem"> </param>
        /// <example>Can be a direct path to a repository.config file</example>
        ///   
        /// <example>Can be a path to a directory, which will recursively locate all contained repository.config files</example>
        public RepositoryManager(string repositoryConfig, IRepositoryEnumerator repositoryEnumerator, IFileSystem fileSystem)
        {
            Contract.Requires(fileSystem != null);
            this.fileSystem = fileSystem;

            if (fileSystem.FileExists(repositoryConfig) && repositoryConfig.EndsWith("repositories.config"))
                RepositoryConfig = new FileInfo(fileSystem.GetFullPath(repositoryConfig));
            else
                throw new ArgumentOutOfRangeException("repository");

            PackageReferenceFiles = repositoryEnumerator.GetPackageReferenceFiles(RepositoryConfig);// GetPackageReferenceFiles();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RepositoryManager"/> class.
        /// </summary>
        /// <param name="repositoryConfig">The repository.config file to parse.</param>
        /// <param name="repositoryEnumerator">The repository enumerator.</param>
        /// <param name="fileSystem"> </param>
        /// <example>Can be a direct path to a repository.config file</example>
        ///
        /// <example>Can be a path to a directory, which will recursively locate all contained repository.config files</example>
        public RepositoryManager(string repositoryConfig, IRepositoryEnumerator repositoryEnumerator, IFileSystem fileSystem)
        {
            Contract.Requires(fileSystem != null);
            this.fileSystem = fileSystem;

            if (fileSystem.FileExists(repositoryConfig) && repositoryConfig.EndsWith("repositories.config"))
            {
                RepositoryConfig = new FileInfo(fileSystem.GetFullPath(repositoryConfig));
            }
            else
            {
                throw new ArgumentOutOfRangeException("repository");
            }

            PackageReferenceFiles = repositoryEnumerator.GetPackageReferenceFiles(RepositoryConfig);// GetPackageReferenceFiles();
        }