Ejemplo n.º 1
0
 public void RestoreToPackageStorage(NugetPackageFullName nugetPackageFullName, string nugetSourceUrl,
                                     string destinationNupkgDirectory, bool overwrite)
 {
     CheckArguments(nugetPackageFullName, nugetSourceUrl);
     RestoreToDirectory(nugetPackageFullName, nugetSourceUrl, destinationNupkgDirectory,
                        gzipPackedPackagesFiles => {
         _packageArchiver.Unpack(gzipPackedPackagesFiles, overwrite, destinationNupkgDirectory);
     });
 }
Ejemplo n.º 2
0
        public static int ExtractPackage(UnzipPkgOptions options, IPackageArchiver packageArchiver,
                                         IPackageUtilities packageUtilities, IFileSystem fileSystem)
        {
            var    packagePath            = GetCorrectedPackagePath(options);
            var    destinationDirectory   = fileSystem.GetCurrentDirectoryIfEmpty(options.DestinationPath);
            string packageName            = fileSystem.ExtractNameFromPath(packagePath);
            var    destinationPackagePath = Path.Combine(destinationDirectory, packageName);

            try {
                Console.WriteLine($"Start unzip package ({packageName}).");
                var overwrite = ShowDialogOverwriteDestinationPackageDir(destinationPackagePath);
                packageArchiver.Unpack(packagePath, overwrite, destinationDirectory);
                Console.WriteLine($"Unzip package ({packageName}) completed.");
                return(0);
            } catch (Exception e) {
                Console.WriteLine($"{e.Message}");
                return(1);
            }
        }