Example #1
0
        public static bool PackageExists(LocalDirectoryNugetRepository repository, PackageID packageID, Version packageVersion)
        {
            // Does the version directory of the package directory exist?
            var packageVersionDirectoryPath = LocalDirectoryNugetRepository.GetPackageVersionDirectoryPath(repository, packageID, packageVersion);

            if (!packageVersionDirectoryPath.Exists())
            {
                return(false);
            }

            var nuspecFilePath = NuGetIoUtilities.GetNuspecFilePath(packageVersionDirectoryPath);

            // Does the nuspec file in the correct directory actually state the specified packageID and version number?
            var packageSpecification = NuGetIoUtilities.GetPackageSpecification(nuspecFilePath);

            if (packageSpecification.ID != packageID)
            {
                return(false);
            }

            if (packageSpecification.Version != packageVersion)
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        public static VersionDirectoryPath GetPackageVersionDirectoryPath(DirectoryPath localPackageRepositoryDirectoryPath, PackageID packageID, Version packageVersion)
        {
            var localDirectoryNugetRepository = new LocalDirectoryNugetRepository(localPackageRepositoryDirectoryPath);

            var output = LocalDirectoryNugetRepository.GetPackageVersionDirectoryPath(localDirectoryNugetRepository, packageID, packageVersion);

            return(output);
        }
Example #3
0
        public static void DeletePackage(LocalDirectoryNugetRepository repository, PackageID packageID, Version packageVersion)
        {
            var packageVersionDirectoryPath = LocalDirectoryNugetRepository.GetPackageVersionDirectoryPath(repository, packageID, packageVersion);

            if (packageVersionDirectoryPath.Exists())
            {
                packageVersionDirectoryPath.Delete();
            }
        }