private static void AddDependencies(FileDownloader downloader, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, string targetDirectory, string group) { Uri uri; long total = 0L; System.Deployment.Application.Manifest.File[] filesInGroup = appManifest.GetFilesInGroup(group, true); ReorderFilesForIconFile(appManifest, filesInGroup); foreach (System.Deployment.Application.Manifest.File file in filesInGroup) { uri = MapFileSourceUri(deployManifest, sourceUriBase, file.Name); AddFileToDownloader(downloader, deployManifest, appManifest, file, uri, targetDirectory, file.NameFS, file.HashCollection); total += (long) file.Size; } DependentAssembly[] privateAssembliesInGroup = appManifest.GetPrivateAssembliesInGroup(group, true); foreach (DependentAssembly assembly in privateAssembliesInGroup) { uri = MapFileSourceUri(deployManifest, sourceUriBase, assembly.Codebase); AddFileToDownloader(downloader, deployManifest, appManifest, assembly, uri, targetDirectory, assembly.CodebaseFS, assembly.HashCollection); total += (long) assembly.Size; } downloader.SetExpectedBytesTotal(total); if ((filesInGroup.Length == 0) && (privateAssembliesInGroup.Length == 0)) { throw new InvalidDeploymentException(string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_NoSuchDownloadGroup"), new object[] { group })); } }
public bool CheckGroupInstalled(System.Deployment.Application.DefinitionAppId appId, AssemblyManifest appManifest, string groupName) { System.Deployment.Internal.Isolation.Store.IPathLock @lock = null; using (@lock = this.LockApplicationPath(appId)) { string path = @lock.Path; System.Deployment.Application.Manifest.File[] filesInGroup = appManifest.GetFilesInGroup(groupName, true); foreach (System.Deployment.Application.Manifest.File file in filesInGroup) { if (!System.IO.File.Exists(Path.Combine(path, file.NameFS))) { return false; } } DependentAssembly[] privateAssembliesInGroup = appManifest.GetPrivateAssembliesInGroup(groupName, true); foreach (DependentAssembly assembly in privateAssembliesInGroup) { if (!System.IO.File.Exists(Path.Combine(path, assembly.CodebaseFS))) { return false; } } if ((filesInGroup.Length + privateAssembliesInGroup.Length) == 0) { throw new InvalidDeploymentException(string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_NoSuchDownloadGroup"), new object[] { groupName })); } } return true; }