Exemple #1
0
            public virtual bool RemovePackage(PackageLocation packageInfo)
            {
                PackageLocations.Remove(packageInfo);
                if (packageInfo.CacheDirectory.TryDelete())
                {
                    PackagesDirectory.GetFile(packageInfo.Package.FullName + ".wrap").Delete();
                    return(true);
                }

                return(false);
            }
Exemple #2
0
            public virtual PackageLocation Publish(IPackageRepository source, string packageFileName, Stream packageStream)
            {
                var wrapFile = PackagesDirectory.GetFile(packageFileName);

                if (wrapFile.Exists)
                {
                    throw new InvalidOperationException(string.Format("Cannot publish package to '{0}' as the file already exists.", wrapFile.Path));
                }

                using (var file = wrapFile.OpenWrite())
                    IO.StreamExtensions.CopyTo(packageStream, file);

                var newPackageCacheDir = _rootCacheDirectory.GetDirectory(wrapFile.NameWithoutExtension);
                var newPackage         = new CachedZipPackage(_parent, wrapFile, newPackageCacheDir);
                var packageLocation    = new PackageLocation(newPackageCacheDir, newPackage);

                PackageLocations.Add(packageLocation);

                return(packageLocation);
            }
Exemple #3
0
 public void Refresh()
 {
     PackageLocations   = LoadPackages().ToList();
     _locationsReadonly = PackageLocations.AsReadOnly();
 }