public override void RemovePackage(IPackage package)
        {
            string fileName = PathResolver.GetPackageFileName(package);

            FileSystem.DeleteFile(fileName);
            DeleteData(package);
        }
示例#2
0
        public override void AddPackage(IPackage package)
        {
            string fileName = PathResolver.GetPackageFileName(package);

            using (Stream stream = package.GetStream())
            {
                FileSystem.AddFile(fileName, stream);
            }
        }
示例#3
0
        public override void AddPackage(IPackage package)
        {
            string fileName = PathResolver.GetPackageFileName(package);

            if (FileSystem.FileExists(fileName) && !AllowOverrideExistingPackageOnPush)
            {
                throw new InvalidOperationException(String.Format(NuGetResources.Error_PackageAlreadyExists, package));
            }
            using (Stream stream = package.GetStream())
            {
                FileSystem.AddFile(fileName, stream);
            }
        }
示例#4
0
        public override void RemovePackage(IPackage package)
        {
            string fileName = PathResolver.GetPackageFileName(package);

            if (EnableDelisting)
            {
                var fullPath = FileSystem.GetFullPath(fileName);
                File.SetAttributes(fullPath, File.GetAttributes(fullPath) | FileAttributes.Hidden);
                // changing file attributes doesn't mark the file as modified. We want to mark the file as modified to
                // ensure the various caches will properly reprocess this package
                File.SetLastWriteTime(fullPath, DateTime.Now);
            }
            else
            {
                FileSystem.DeleteFile(fileName);
                DeleteData(package);
            }
        }
示例#5
0
        public override void AddPackage(IPackage package)
        {
            string fileName = PathResolver.GetPackageFileName(package);

            if (FileSystem.FileExists(fileName) && !AllowOverrideExistingPackageOnPush)
            {
                throw new InvalidOperationException(String.Format(NuGetResources.Error_PackageAlreadyExists, package));
            }

            _cacheLock.EnterWriteLock();
            try
            {
                _derivedDataLookup.Remove(package);
            }
            finally
            {
                _cacheLock.ExitWriteLock();
            }

            using (Stream stream = package.GetStream())
            {
                FileSystem.AddFile(fileName, stream);
            }
        }