public static Tuple <string, IEnumerable <ZipFilePair> > GetInstalledSatelliteFiles(
            PackageArchiveReader packageReader,
            PackagePathResolver packagePathResolver,
            PackageSaveMode packageSaveMode)
        {
            var    installedSatelliteFiles = Enumerable.Empty <ZipFilePair>();
            string runtimePackageDirectory;
            var    satelliteFiles = GetSatelliteFiles(packageReader, packagePathResolver, out runtimePackageDirectory);

            if (satelliteFiles.Any())
            {
                var satelliteFileEntries = packageReader.EnumeratePackageEntries(
                    satelliteFiles.Where(f => IsPackageFile(f, packageSaveMode)),
                    runtimePackageDirectory);
                installedSatelliteFiles = satelliteFileEntries.Where(e => e.IsInstalled());
            }

            return(new Tuple <string, IEnumerable <ZipFilePair> >(runtimePackageDirectory, installedSatelliteFiles.ToList()));
        }
        /// <summary>
        /// This returns all the installed package files (does not include satellite files)
        /// </summary>
        public static IEnumerable <ZipFilePair> GetInstalledPackageFiles(
            PackageArchiveReader packageReader,
            PackageIdentity packageIdentity,
            PackagePathResolver packagePathResolver,
            PackageSaveMode packageSaveMode)
        {
            var installedPackageFiles = Enumerable.Empty <ZipFilePair>();

            var packageDirectory = packagePathResolver.GetInstalledPath(packageIdentity);

            if (!string.IsNullOrEmpty(packageDirectory))
            {
                var packageFiles = packageReader.GetPackageFiles(packageSaveMode);
                var entries      = packageReader.EnumeratePackageEntries(packageFiles, packageDirectory);
                installedPackageFiles = entries.Where(e => e.IsInstalled());
            }

            return(installedPackageFiles.ToList());
        }
        /// <summary>
        /// This returns all the installed package files (does not include satellite files)
        /// </summary>
        public static async Task <IEnumerable <ZipFilePair> > GetInstalledPackageFilesAsync(
            PackageArchiveReader packageReader,
            PackageIdentity packageIdentity,
            PackagePathResolver packagePathResolver,
            PackageSaveMode packageSaveMode,
            CancellationToken cancellationToken)
        {
            var installedPackageFiles = Enumerable.Empty <ZipFilePair>();

            var packageDirectory = packagePathResolver.GetInstalledPath(packageIdentity);

            if (!string.IsNullOrEmpty(packageDirectory))
            {
                var packageFiles = await packageReader.GetPackageFilesAsync(packageSaveMode, cancellationToken);

                var entries = packageReader.EnumeratePackageEntries(packageFiles, packageDirectory);
                installedPackageFiles = entries.Where(e => e.IsInstalled());
            }

            return(installedPackageFiles.ToList());
        }
        public static async Task <Tuple <string, IEnumerable <ZipFilePair> > > GetInstalledSatelliteFilesAsync(
            PackageArchiveReader packageReader,
            PackagePathResolver packagePathResolver,
            PackageSaveMode packageSaveMode,
            CancellationToken cancellationToken)
        {
            var installedSatelliteFiles = Enumerable.Empty <ZipFilePair>();

            var result = await GetSatelliteFilesAsync(packageReader, packagePathResolver, cancellationToken);

            var runtimePackageDirectory = result.Item1;
            var satelliteFiles          = result.Item2;

            if (satelliteFiles.Any())
            {
                var satelliteFileEntries = packageReader.EnumeratePackageEntries(
                    satelliteFiles.Where(f => IsPackageFile(f, packageSaveMode)),
                    runtimePackageDirectory);
                installedSatelliteFiles = satelliteFileEntries.Where(e => e.IsInstalled());
            }

            return(new Tuple <string, IEnumerable <ZipFilePair> >(runtimePackageDirectory, installedSatelliteFiles.ToList()));
        }