示例#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);
        }
示例#2
0
        public static void DeletePackage(LocalDirectoryNugetRepository repository, PackageID packageID, Version packageVersion)
        {
            var packageVersionDirectoryPath = LocalDirectoryNugetRepository.GetPackageVersionDirectoryPath(repository, packageID, packageVersion);

            if (packageVersionDirectoryPath.Exists())
            {
                packageVersionDirectoryPath.Delete();
            }
        }
示例#3
0
 public PackageSpecification(PackageID name)
     : this(name, VersionHelper.None)
 {
 }
示例#4
0
 public PackageSpecification(PackageID name, Version version)
 {
     this.ID      = name;
     this.Version = version;
 }
示例#5
0
        public static VersionDirectoryPath GetPackageVersionDirectoryPath(LocalDirectoryNugetRepository repository, PackageID packageID, Version packageVersion)
        {
            var packageDirectoryPath = LocalDirectoryNugetRepository.GetPackageDirectoryPath(repository, packageID);

            var versionDirectoryName = NuGetIoUtilities.GetVersionDirectoryName(packageVersion);

            var packageVersionDirectoryPath = PathUtilitiesExtra.Combine(packageDirectoryPath, versionDirectoryName).Value.AsVersionDirectoryPath();

            return(packageVersionDirectoryPath);
        }
示例#6
0
        public static PackageDirectoryPath GetPackageDirectoryPath(DirectoryPath localPackageRepositoryDirectoryPath, PackageID packageID)
        {
            var localDirectoryNugetRepository = new LocalDirectoryNugetRepository(localPackageRepositoryDirectoryPath);

            var output = LocalDirectoryNugetRepository.GetPackageDirectoryPath(localDirectoryNugetRepository, packageID);

            return(output);
        }
示例#7
0
        public static PackageDirectoryPath GetPackageDirectoryPath(LocalDirectoryNugetRepository repository, PackageID packageID)
        {
            var packageDirectoryName = NuGetIoUtilities.GetPackageDirectoryName(packageID);

            var packageDirectoryPath = PathUtilitiesExtra.Combine(repository.DirectoryPath, packageDirectoryName).Value.AsPackageDirectoryPath();

            return(packageDirectoryPath);
        }
示例#8
0
        public static void ListAllPackageVersions(DirectoryPath localPackageRepositoryDirectoryPath, PackageID packageID, TextWriter writer)
        {
            var localDirectoryNugetRepository = new LocalDirectoryNugetRepository(localPackageRepositoryDirectoryPath);

            LocalDirectoryNugetRepository.ListAllPackageVersions(localDirectoryNugetRepository, packageID, writer);
        }
示例#9
0
        public static void ListAllPackageVersions(LocalDirectoryNugetRepository repository, PackageID packageID, TextWriter writer)
        {
            var packageDirectoryName = NuGetIoUtilities.GetPackageDirectoryName(packageID);

            var packageDirectoryPath = PathUtilitiesExtra.Combine(repository.DirectoryPath, packageDirectoryName).Value.AsPackageDirectoryPath();

            LocalDirectoryNugetRepository.ListAllPackageVersions(packageDirectoryPath, writer);
        }
示例#10
0
        public static void DeletePackage(DirectoryPath localPackageRepositoryDirectoryPath, PackageID packageID, Version packageVersion)
        {
            var localDirectoryNugetRepository = new LocalDirectoryNugetRepository(localPackageRepositoryDirectoryPath);

            LocalDirectoryNugetRepository.DeletePackage(localDirectoryNugetRepository, packageID, packageVersion);
        }
示例#11
0
        public static bool PackageExists(DirectoryPath localPackageRepositoryDirectoryPath, PackageID packageID, Version packageVersion)
        {
            var localDirectoryNugetRepository = new LocalDirectoryNugetRepository(localPackageRepositoryDirectoryPath);

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

            return(output);
        }
示例#12
0
        /// <summary>
        /// The default package ID is the same as the project file-name-without-extensions.
        /// </summary>
        public static PackageID GetDefaultPackageID(FileNameWithoutExtension projectFileNameWithoutExtension)
        {
            var packageID = new PackageID(projectFileNameWithoutExtension.Value);

            return(packageID);
        }