示例#1
0
        private void ExpandFiles(IPackage package)
        {
            IBatchProcessor <string> fileSystem = this.FileSystem as IBatchProcessor <string>;

            try
            {
                IPackage            package2;
                List <IPackageFile> files = package.GetFiles().ToList <IPackageFile>();
                if (fileSystem != null)
                {
                    fileSystem.BeginProcessing(from p in files select p.Path, PackageAction.Install);
                }
                this.FileSystem.AddFiles(files, this.PathResolver.GetPackageDirectory(package));
                if (PackageHelper.IsSatellitePackage(package, this.LocalRepository, null, out package2))
                {
                    IEnumerable <IPackageFile> satelliteFiles = package.GetSatelliteFiles();
                    this.FileSystem.AddFiles(satelliteFiles, this.PathResolver.GetPackageDirectory(package2));
                }
            }
            finally
            {
                if (fileSystem != null)
                {
                    fileSystem.EndProcessing();
                }
            }
        }
示例#2
0
        protected void ExpandSatellitePackageFiles(IPackage package)
        {
            // If this is a Satellite Package, then copy the satellite files into the related runtime package folder too
            IPackage runtimePackage;

            if (PackageHelper.IsSatellitePackage(package, LocalRepository, targetFramework: null, runtimePackage: out runtimePackage))
            {
                var satelliteFiles = package.GetSatelliteFiles();
                var runtimePath    = PathResolver.GetPackageDirectory(runtimePackage);
                FileSystem.AddFiles(satelliteFiles, runtimePath);
            }
        }
示例#3
0
        private void RemoveFiles(IPackage package)
        {
            IPackage package2;
            string   packageDirectory = this.PathResolver.GetPackageDirectory(package);

            if (PackageHelper.IsSatellitePackage(package, this.LocalRepository, null, out package2))
            {
                IEnumerable <IPackageFile> satelliteFiles = package.GetSatelliteFiles();
                this.FileSystem.DeleteFiles(satelliteFiles, this.PathResolver.GetPackageDirectory(package2));
            }
            this.FileSystem.DeleteFiles(package.GetFiles(), packageDirectory);
        }
示例#4
0
        private void RemoveFiles(IPackage package)
        {
            string packageDirectory = PathResolver.GetPackageDirectory(package);

            // If this is a Satellite Package, then remove the files from the related runtime package folder too
            IPackage runtimePackage;

            if (PackageHelper.IsSatellitePackage(package, LocalRepository, targetFramework: null, runtimePackage: out runtimePackage))
            {
                var satelliteFiles = package.GetSatelliteFiles();
                var runtimePath    = PathResolver.GetPackageDirectory(runtimePackage);
                FileSystem.DeleteFiles(satelliteFiles, runtimePath);
            }

            // Remove package files
            // IMPORTANT: This has to be done AFTER removing satellite files from runtime package,
            // because starting from 2.1, we read satellite files directly from package files, instead of .nupkg
            FileSystem.DeleteFiles(package.GetFiles(), packageDirectory);
        }
示例#5
0
        private void ExpandFiles(IPackage package)
        {
            var batchProcessor = FileSystem as IBatchProcessor <string>;

            try
            {
                var files = package.GetFiles().ToList();
                if (batchProcessor != null)
                {
                    // Notify the batch processor that the files are being added. This is to allow source controlled file systems
                    // to manage previously uninstalled files.
                    batchProcessor.BeginProcessing(files.Select(p => p.Path), PackageAction.Install);
                }

                string packageDirectory = PathResolver.GetPackageDirectory(package);

                // Add files
                FileSystem.AddFiles(files, packageDirectory);

                // If this is a Satellite Package, then copy the satellite files into the related runtime package folder too
                IPackage runtimePackage;
                if (PackageHelper.IsSatellitePackage(package, LocalRepository, targetFramework: null, runtimePackage: out runtimePackage))
                {
                    var satelliteFiles = package.GetSatelliteFiles();
                    var runtimePath    = PathResolver.GetPackageDirectory(runtimePackage);
                    FileSystem.AddFiles(satelliteFiles, runtimePath);
                }
            }
            finally
            {
                if (batchProcessor != null)
                {
                    batchProcessor.EndProcessing();
                }
            }
        }