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 }));
     }
 }
 private static void AddShellExtensions(DefinitionIdentity subId, Uri deploymentProviderUri, AssemblyManifest appManifest)
 {
     foreach (FileAssociation association in appManifest.FileAssociations)
     {
         AddFileAssociation(association, subId, deploymentProviderUri);
     }
 }
 private void Activate(DefinitionAppId appId, AssemblyManifest appManifest, string activationParameter, bool useActivationParameter)
 {
     using (ActivationContext context = ActivationContext.CreatePartialActivationContext(appId.ToApplicationIdentity()))
     {
         InternalActivationContextHelper.PrepareForExecution(context);
         this._subStore.ActivateApplication(appId, activationParameter, useActivationParameter);
     }
 }
 internal static AssemblyManifest FromDocument(string localPath, AssemblyManifest.ManifestType manifestType, Uri sourceUri)
 {
     AssemblyManifest manifest;
     CodeMarker_Singleton.Instance.CodeMarker(CodeMarkerEvent.perfParseBegin);
     Logger.AddMethodCall("ManifestReader.FromDocument(" + localPath + ") called.");
     FileInfo info = new FileInfo(localPath);
     if (info.Length > 0x1000000L)
     {
         throw new DeploymentException(Resources.GetString("Ex_ManifestFileTooLarge"));
     }
     FileStream input = new FileStream(localPath, FileMode.Open, FileAccess.Read);
     try
     {
         XmlReader reader = PolicyKeys.SkipSchemaValidation() ? XmlReader.Create(input) : ManifestValidatingReader.Create(input);
         while (reader.Read())
         {
         }
         Logger.AddInternalState("Schema validation passed.");
         manifest = new AssemblyManifest(input);
         Logger.AddInternalState("Manifest is parsed successfully.");
         if (!PolicyKeys.SkipSemanticValidation())
         {
             manifest.ValidateSemantics(manifestType);
         }
         Logger.AddInternalState("Semantic validation passed.");
         if (!PolicyKeys.SkipSignatureValidation())
         {
             input.Position = 0L;
             manifest.ValidateSignature(input);
         }
         Logger.AddInternalState("Signature validation passed.");
     }
     catch (XmlException exception)
     {
         string message = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_ManifestFromDocument"), new object[] { (sourceUri != null) ? sourceUri.AbsoluteUri : Path.GetFileName(localPath) });
         throw new InvalidDeploymentException(ExceptionTypes.ManifestParse, message, exception);
     }
     catch (XmlSchemaValidationException exception2)
     {
         string str2 = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_ManifestFromDocument"), new object[] { (sourceUri != null) ? sourceUri.AbsoluteUri : Path.GetFileName(localPath) });
         throw new InvalidDeploymentException(ExceptionTypes.ManifestParse, str2, exception2);
     }
     catch (InvalidDeploymentException exception3)
     {
         string str3 = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_ManifestFromDocument"), new object[] { (sourceUri != null) ? sourceUri.AbsoluteUri : Path.GetFileName(localPath) });
         throw new InvalidDeploymentException(ExceptionTypes.ManifestParse, str3, exception3);
     }
     finally
     {
         if (input != null)
         {
             input.Dispose();
         }
     }
     CodeMarker_Singleton.Instance.CodeMarker(CodeMarkerEvent.perfParseEnd);
     return manifest;
 }
 public static AssemblyManifest DownloadApplicationManifest(AssemblyManifest deploymentManifest, string targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, out Uri appSourceUri, out string appManifestPath)
 {
     ServerInformation information;
     Logger.AddMethodCall("DownloadApplicationManifest called.");
     DependentAssembly mainDependentAssembly = deploymentManifest.MainDependentAssembly;
     if ((mainDependentAssembly == null) || (mainDependentAssembly.Codebase == null))
     {
         throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_NoAppInDeploymentManifest"));
     }
     appSourceUri = new Uri(deploymentUri, mainDependentAssembly.Codebase);
     Zone zone = Zone.CreateFromUrl(deploymentUri.AbsoluteUri);
     Zone zone2 = Zone.CreateFromUrl(appSourceUri.AbsoluteUri);
     if (!zone.Equals(zone2))
     {
         Logger.AddInternalState(string.Concat(new object[] { "Deployment and application does not have matching security zones. deploymentZone=", zone, ",applicationZone=", zone2 }));
         throw new InvalidDeploymentException(ExceptionTypes.Zone, Resources.GetString("Ex_DeployAppZoneMismatch"));
     }
     appManifestPath = Path.Combine(targetDir, mainDependentAssembly.Identity.Name + ".manifest");
     AssemblyManifest manifest = DownloadManifest(ref appSourceUri, appManifestPath, notification, options, AssemblyManifest.ManifestType.Application, out information);
     Logger.SetApplicationUrl(appSourceUri);
     Logger.SetApplicationServerInformation(information);
     zone2 = Zone.CreateFromUrl(appSourceUri.AbsoluteUri);
     if (!zone.Equals(zone2))
     {
         Logger.AddInternalState(string.Concat(new object[] { "Deployment and application does not have matching security zones. deploymentZone=", zone, ",applicationZone=", zone2 }));
         throw new InvalidDeploymentException(ExceptionTypes.Zone, Resources.GetString("Ex_DeployAppZoneMismatch"));
     }
     if (manifest.Identity.Equals(deploymentManifest.Identity))
     {
         throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DepSameDeploymentAndApplicationIdentity"), new object[] { manifest.Identity.ToString() }));
     }
     if (!manifest.Identity.Matches(mainDependentAssembly.Identity, manifest.Application))
     {
         throw new InvalidDeploymentException(ExceptionTypes.SubscriptionSemanticValidation, Resources.GetString("Ex_RefDefMismatch"));
     }
     if (!PolicyKeys.SkipApplicationDependencyHashCheck())
     {
         try
         {
             ComponentVerifier.VerifyFileHash(appManifestPath, mainDependentAssembly.HashCollection);
         }
         catch (InvalidDeploymentException exception)
         {
             if (exception.SubType == ExceptionTypes.HashValidation)
             {
                 throw new InvalidDeploymentException(ExceptionTypes.HashValidation, Resources.GetString("Ex_AppManInvalidHash"), exception);
             }
             throw;
         }
     }
     if (manifest.RequestedExecutionLevel != null)
     {
         Logger.AddInternalState("Application manifest has RequestedExecutionLevel specified. Check requested privileges.");
         VerifyRequestedPrivilegesSupport(manifest.RequestedExecutionLevel);
     }
     return manifest;
 }
 public void SetApplicationManifest(AssemblyManifest manifest, Uri manifestUri, string manifestPath)
 {
     base.AppManifest = manifest;
     base.AppSourceUri = manifestUri;
     base.AppManifestPath = manifestPath;
     if (base.AppManifest.EntryPoints[0].CustomHostSpecified)
     {
         base.appType = AppType.CustomHostSpecified;
     }
     if (base.AppManifest.EntryPoints[0].CustomUX)
     {
         base.appType = AppType.CustomUX;
     }
 }
 private static void AddFilesInHashtable(Hashtable hashtable, AssemblyManifest applicationManifest, string applicationFolder)
 {
     Logger.AddMethodCall("AddFilesInHashtable called.");
     Logger.AddInternalState("applicationFolder=" + applicationFolder);
     string location = null;
     foreach (System.Deployment.Application.Manifest.File file in applicationManifest.Files)
     {
         location = Path.Combine(applicationFolder, file.NameFS);
         try
         {
             AddSingleFileInHashtable(hashtable, file.HashCollection, location);
         }
         catch (IOException exception)
         {
             Logger.AddErrorInformation(exception, Resources.GetString("Ex_PatchDependencyFailed"), new object[] { Path.GetFileName(location) });
             Logger.AddInternalState("Exception thrown : " + exception.GetType().ToString() + ":" + exception.Message);
         }
     }
     foreach (DependentAssembly assembly in applicationManifest.DependentAssemblies)
     {
         if (!assembly.IsPreRequisite)
         {
             location = Path.Combine(applicationFolder, assembly.Codebase);
             try
             {
                 if (AddSingleFileInHashtable(hashtable, assembly.HashCollection, location))
                 {
                     AssemblyManifest manifest = new AssemblyManifest(location);
                     System.Deployment.Application.Manifest.File[] files = manifest.Files;
                     for (int i = 0; i < files.Length; i++)
                     {
                         string str2 = Path.Combine(Path.GetDirectoryName(location), files[i].NameFS);
                         AddSingleFileInHashtable(hashtable, files[i].HashCollection, str2);
                     }
                 }
             }
             catch (InvalidDeploymentException exception2)
             {
                 Logger.AddErrorInformation(exception2, Resources.GetString("Ex_PatchDependencyFailed"), new object[] { Path.GetFileName(location) });
                 Logger.AddInternalState("Exception thrown : " + exception2.GetType().ToString() + ":" + exception2.Message);
             }
             catch (IOException exception3)
             {
                 Logger.AddErrorInformation(exception3, Resources.GetString("Ex_PatchDependencyFailed"), new object[] { Path.GetFileName(location) });
                 Logger.AddInternalState("Exception thrown : " + exception3.GetType().ToString() + ":" + exception3.Message);
             }
         }
     }
 }
 internal static AssemblyManifest FromDocumentNoValidation(string localPath)
 {
     AssemblyManifest manifest;
     CodeMarker_Singleton.Instance.CodeMarker(CodeMarkerEvent.perfParseBegin);
     Logger.AddMethodCall("ManifestReader.FromDocumentNoValidation(" + localPath + ") called.");
     FileInfo info = new FileInfo(localPath);
     if (info.Length > 0x1000000L)
     {
         throw new DeploymentException(Resources.GetString("Ex_ManifestFileTooLarge"));
     }
     using (FileStream stream = new FileStream(localPath, FileMode.Open, FileAccess.Read))
     {
         manifest = new AssemblyManifest(stream);
     }
     CodeMarker_Singleton.Instance.CodeMarker(CodeMarkerEvent.perfParseEnd);
     return manifest;
 }
 public EntryPoint(System.Deployment.Internal.Isolation.Manifest.EntryPointEntry entryPointEntry, AssemblyManifest manifest)
 {
     this._name = entryPointEntry.Name;
     this._commandLineFile = entryPointEntry.CommandLine_File;
     this._commandLineParamater = entryPointEntry.CommandLine_Parameters;
     this._hostInBrowser = (entryPointEntry.Flags & 1) != 0;
     this._customHostSpecified = (entryPointEntry.Flags & 2) != 0;
     this._customUX = (entryPointEntry.Flags & 4) != 0;
     if (!this._customHostSpecified)
     {
         if (entryPointEntry.Identity != null)
         {
             this._dependentAssembly = manifest.GetDependentAssemblyByIdentity(entryPointEntry.Identity);
         }
         if (this._dependentAssembly == null)
         {
             throw new InvalidDeploymentException(ExceptionTypes.ManifestParse, Resources.GetString("Ex_NoMatchingAssemblyForEntryPoint"));
         }
     }
 }
 public void Reset()
 {
     this.IsInstalled = this.IsShellVisible = false;
     this.CurrentBind = this.PreviousBind = (DefinitionAppId) (this.PendingBind = null);
     this.ExcludedDeployment = (DefinitionIdentity) (this.PendingDeployment = null);
     this.DeploymentProviderUri = null;
     this.MinimumRequiredVersion = null;
     this.LastCheckTime = DateTime.MinValue;
     this.UpdateSkippedDeployment = null;
     this.UpdateSkipTime = DateTime.MinValue;
     this.CurrentDeployment = null;
     this.RollbackDeployment = null;
     this.CurrentDeploymentManifest = null;
     this.CurrentDeploymentSourceUri = null;
     this.CurrentApplication = null;
     this.CurrentApplicationManifest = null;
     this.CurrentApplicationSourceUri = null;
     this.PreviousApplication = null;
     this.PreviousApplicationManifest = null;
     this.appType = AppType.None;
 }
 public CommitApplicationParams(CommitApplicationParams src)
 {
     this.TimeStamp = DateTime.MinValue;
     this.AppId = src.AppId;
     this.CommitApp = src.CommitApp;
     this.AppManifest = src.AppManifest;
     this.AppSourceUri = src.AppSourceUri;
     this.AppManifestPath = src.AppManifestPath;
     this.AppPayloadPath = src.AppPayloadPath;
     this.AppGroup = src.AppGroup;
     this.CommitDeploy = src.CommitDeploy;
     this.DeployManifest = src.DeployManifest;
     this.DeploySourceUri = src.DeploySourceUri;
     this.DeployManifestPath = src.DeployManifestPath;
     this.TimeStamp = src.TimeStamp;
     this.IsConfirmed = src.IsConfirmed;
     this.IsUpdate = src.IsUpdate;
     this.IsRequiredUpdate = src.IsRequiredUpdate;
     this.IsUpdateInPKTGroup = src.IsUpdateInPKTGroup;
     this.IsFullTrustRequested = src.IsFullTrustRequested;
     this.appType = src.appType;
     this.Trust = src.Trust;
 }
 public DependencyDownloadCookie(object manifestElement, AssemblyManifest deployManifest, AssemblyManifest appManifest)
 {
     this.ManifestElement = manifestElement;
     this.DeployManifest = deployManifest;
     this.AppManifest = appManifest;
 }
 private static void VerifyRequestedPrivilegesSupport(AssemblyManifest appManifest, string targetDirectory)
 {
     if (!appManifest.EntryPoints[0].CustomHostSpecified)
     {
         string path = Path.Combine(targetDirectory, appManifest.EntryPoints[0].Assembly.Codebase);
         if (System.IO.File.Exists(path))
         {
             AssemblyManifest manifest = new AssemblyManifest(path);
             if (manifest.Id1ManifestPresent && (manifest.Id1RequestedExecutionLevel != null))
             {
                 VerifyRequestedPrivilegesSupport(manifest.Id1RequestedExecutionLevel);
             }
         }
         else
         {
             Logger.AddInternalState("Main exe=" + path + " does not exist. No Requested Priviliges Verification done.");
         }
     }
 }
 public void SetDeploymentManifest(AssemblyManifest manifest, Uri manifestUri, string manifestPath)
 {
     base.DeploySourceUri = manifestUri;
     base.DeployManifest = manifest;
     base.DeployManifestPath = manifestPath;
 }
 public static void RemoveShellExtensions(DefinitionIdentity subId, AssemblyManifest appManifest, string productName)
 {
     foreach (FileAssociation association in appManifest.FileAssociations)
     {
         RemoveFileAssociation(association, subId, productName);
     }
     System.Deployment.Application.NativeMethods.SHChangeNotify(0x8000000, 0, IntPtr.Zero, IntPtr.Zero);
 }
 internal static void SetDeploymentManifest(AssemblyManifest deploymentManifest)
 {
     Logger currentThreadLogger = GetCurrentThreadLogger();
     if (currentThreadLogger != null)
     {
         lock (currentThreadLogger)
         {
             if (deploymentManifest.Identity != null)
             {
                 currentThreadLogger.Identities.DeploymentIdentity = deploymentManifest.Identity;
             }
             currentThreadLogger.Summary.DeploymentManifest = deploymentManifest;
         }
     }
 }
 private static void AddFileToDownloader(FileDownloader downloader, AssemblyManifest deployManifest, AssemblyManifest appManifest, object manifestElement, Uri fileSourceUri, string targetDirectory, string targetFileName, HashCollection hashCollection)
 {
     string targetFilePath = Path.Combine(targetDirectory, targetFileName);
     DependencyDownloadCookie cookie = new DependencyDownloadCookie(manifestElement, deployManifest, appManifest);
     downloader.AddFile(fileSourceUri, targetFilePath, cookie, hashCollection);
 }
 public static bool FollowDeploymentProviderUri(SubscriptionStore subStore, ref AssemblyManifest deployment, ref Uri sourceUri, out TempFile tempFile, IDownloadNotification notification, DownloadOptions options)
 {
     Logger.AddMethodCall("FollowDeploymentProviderUri called.");
     tempFile = null;
     bool flag = false;
     Zone zone = Zone.CreateFromUrl(sourceUri.AbsoluteUri);
     bool flag2 = false;
     if (zone.SecurityZone != SecurityZone.MyComputer)
     {
         Logger.AddInternalState("Deployment manifest zone is not local machine. Zone = " + zone.SecurityZone);
         flag2 = true;
     }
     else
     {
         Logger.AddInternalState("Deployment manifest zone is local machine. Zone = " + zone.SecurityZone);
         DependentAssembly mainDependentAssembly = deployment.MainDependentAssembly;
         if ((mainDependentAssembly == null) || (mainDependentAssembly.Codebase == null))
         {
             throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_NoAppInDeploymentManifest"));
         }
         Uri uri = new Uri(sourceUri, mainDependentAssembly.Codebase);
         Zone zone2 = Zone.CreateFromUrl(uri.AbsoluteUri);
         if (zone2.SecurityZone == SecurityZone.MyComputer)
         {
             Logger.AddInternalState("Application manifest zone is local machine. Zone = " + zone2.SecurityZone);
             if (!System.IO.File.Exists(uri.LocalPath))
             {
                 Logger.AddInternalState(uri.LocalPath + " does not exist in local machine.");
                 flag2 = true;
             }
         }
     }
     if (flag2)
     {
         Uri providerCodebaseUri = deployment.Deployment.ProviderCodebaseUri;
         Logger.SetDeploymentProviderUrl(providerCodebaseUri);
         Logger.AddInternalState(string.Concat(new object[] { "providerUri=", providerCodebaseUri, ",sourceUri=", sourceUri }));
         if ((!PolicyKeys.SkipDeploymentProvider() && (providerCodebaseUri != null)) && !providerCodebaseUri.Equals(sourceUri))
         {
             ServerInformation information;
             AssemblyManifest manifest = null;
             try
             {
                 manifest = DownloadDeploymentManifestDirect(subStore, ref providerCodebaseUri, out tempFile, notification, options, out information);
             }
             catch (InvalidDeploymentException exception)
             {
                 if (((exception.SubType != ExceptionTypes.Manifest) && (exception.SubType != ExceptionTypes.ManifestLoad)) && ((exception.SubType != ExceptionTypes.ManifestParse) && (exception.SubType != ExceptionTypes.ManifestSemanticValidation)))
                 {
                     throw;
                 }
                 throw new InvalidDeploymentException(ExceptionTypes.Manifest, Resources.GetString("Ex_InvalidProviderManifest"), exception);
             }
             Logger.SetDeploymentProviderServerInformation(information);
             SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment);
             if (!subStore.GetSubscriptionState(manifest).SubscriptionId.Equals(subscriptionState.SubscriptionId))
             {
                 throw new InvalidDeploymentException(ExceptionTypes.SubscriptionSemanticValidation, Resources.GetString("Ex_ProviderNotInSubscription"));
             }
             Logger.AddInternalState("Deployment provider followed: " + providerCodebaseUri);
             deployment = manifest;
             sourceUri = providerCodebaseUri;
             flag = true;
         }
     }
     if (!flag)
     {
         Logger.AddInternalState("Deployment provider not followed.");
     }
     return flag;
 }
 private static AssemblyManifest DownloadManifest(ref Uri sourceUri, string targetPath, IDownloadNotification notification, DownloadOptions options, AssemblyManifest.ManifestType manifestType, out ServerInformation serverInformation)
 {
     Logger.AddMethodCall("DownloadManifest called.");
     DownloadManifestAsRawFile(ref sourceUri, targetPath, notification, options, out serverInformation);
     return ManifestReader.FromDocument(targetPath, manifestType, sourceUri);
 }
 public static void DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, string targetDirectory, string group, IDownloadNotification notification, DownloadOptions options)
 {
     Logger.AddMethodCall("DownloadDependencies called.");
     Logger.AddInternalState("sourceUriBase=" + sourceUriBase);
     Logger.AddInternalState("targetDirectory=" + targetDirectory);
     Logger.AddInternalState("group=" + group);
     Logger.AddInternalState("DownloadOptions=" + options);
     FileDownloader downloader = FileDownloader.Create();
     downloader.Options = options;
     if (group == null)
     {
         downloader.CheckForSizeLimit(appManifest.CalculateDependenciesSize(), false);
     }
     AddDependencies(downloader, deployManifest, appManifest, sourceUriBase, targetDirectory, group);
     downloader.DownloadModified += new FileDownloader.DownloadModifiedEventHandler(DownloadManager.ProcessDownloadedFile);
     if (notification != null)
     {
         downloader.AddNotification(notification);
     }
     try
     {
         downloader.Download(subState);
         downloader.ComponentVerifier.VerifyComponents();
         VerifyRequestedPrivilegesSupport(appManifest, targetDirectory);
     }
     finally
     {
         if (notification != null)
         {
             downloader.RemoveNotification(notification);
         }
         downloader.DownloadModified -= new FileDownloader.DownloadModifiedEventHandler(DownloadManager.ProcessDownloadedFile);
     }
 }
 internal static void SetApplicationManifest(AssemblyManifest applicationManifest)
 {
     Logger currentThreadLogger = GetCurrentThreadLogger();
     if (currentThreadLogger != null)
     {
         lock (currentThreadLogger)
         {
             if (applicationManifest.Identity != null)
             {
                 currentThreadLogger.Identities.ApplicationIdentity = applicationManifest.Identity;
             }
             currentThreadLogger.Summary.ApplicationManifest = applicationManifest;
         }
     }
 }
 public Version CheckUpdateInManifest(SubscriptionState subState, Uri updateCodebaseUri, AssemblyManifest deployment, Version currentVersion, ref bool bUpdateInPKTGroup)
 {
     CheckOnlineShellVisibleConflict(subState, deployment);
     CheckInstalledAndUpdateableConflict(subState, deployment);
     CheckMinimumRequiredVersion(subState, deployment);
     SubscriptionState subscriptionState = this.GetSubscriptionState(deployment);
     if (!subscriptionState.SubscriptionId.Equals(subState.SubscriptionId))
     {
         Logger.AddInternalState("Cross family update detected. Check if only PKT has changed between versions.");
         Logger.AddInternalState(string.Concat(new object[] { "updateCodebaseUri=", updateCodebaseUri, ", subState.DeploymentProviderUri=", subState.DeploymentProviderUri }));
         Logger.AddInternalState(string.Concat(new object[] { "subState=", subState.SubscriptionId, ", manSubState.SubscriptionId=", subscriptionState.SubscriptionId }));
         if (!updateCodebaseUri.Equals(subState.DeploymentProviderUri) || !subState.PKTGroupId.Equals(subscriptionState.PKTGroupId))
         {
             throw new DeploymentException(ExceptionTypes.SubscriptionState, Resources.GetString("Ex_DeploymentIdentityNotInSubscription"));
         }
         Logger.AddInternalState("PKT has changed.");
         bUpdateInPKTGroup = true;
     }
     Version version = deployment.Identity.Version;
     if (version.CompareTo(currentVersion) == 0)
     {
         return null;
     }
     return version;
 }
 internal static void SetApplicationManifest(LogIdentity log, AssemblyManifest applicationManifest)
 {
     Logger logger = GetLogger(log);
     if (logger != null)
     {
         lock (logger)
         {
             if (applicationManifest.Identity != null)
             {
                 logger.Identities.ApplicationIdentity = applicationManifest.Identity;
             }
             logger.Summary.ApplicationManifest = applicationManifest;
         }
     }
 }
 private static void ProcessDownloadedFile(object sender, DownloadEventArgs e)
 {
     if (e.Cookie != null)
     {
         string fileName = Path.GetFileName(e.FileLocalPath);
         FileDownloader downloader = (FileDownloader) sender;
         if ((e.FileResponseUri != null) && !e.FileResponseUri.Equals(e.FileSourceUri))
         {
             throw new InvalidDeploymentException(ExceptionTypes.AppFileLocationValidation, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DownloadAppFileAsmRedirected"), new object[] { fileName }));
         }
         DependencyDownloadCookie cookie = (DependencyDownloadCookie) e.Cookie;
         if (cookie.ManifestElement is DependentAssembly)
         {
             DependentAssembly manifestElement = (DependentAssembly) cookie.ManifestElement;
             AssemblyManifest deployManifest = cookie.DeployManifest;
             AssemblyManifest appManifest = cookie.AppManifest;
             AssemblyManifest assemblyManifest = new AssemblyManifest(e.FileLocalPath);
             if (!assemblyManifest.Identity.Matches(manifestElement.Identity, true))
             {
                 throw new InvalidDeploymentException(ExceptionTypes.RefDefValidation, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DownloadRefDefMismatch"), new object[] { fileName }));
             }
             if (assemblyManifest.Identity.Equals(deployManifest.Identity) || assemblyManifest.Identity.Equals(appManifest.Identity))
             {
                 throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_AppPrivAsmIdSameAsDeployOrApp"), new object[] { assemblyManifest.Identity.ToString() }));
             }
             System.Deployment.Application.Manifest.File[] files = assemblyManifest.Files;
             for (int i = 0; i < files.Length; i++)
             {
                 Uri fileSourceUri = MapFileSourceUri(deployManifest, e.FileSourceUri, files[i].Name);
                 if (!fileSourceUri.AbsoluteUri.Equals(e.FileSourceUri.AbsoluteUri, StringComparison.OrdinalIgnoreCase))
                 {
                     string directoryName = Path.GetDirectoryName(e.FileLocalPath);
                     AddFileToDownloader(downloader, deployManifest, appManifest, files[i], fileSourceUri, directoryName, files[i].NameFS, files[i].HashCollection);
                 }
             }
             downloader.ComponentVerifier.AddFileForVerification(e.FileLocalPath, manifestElement.HashCollection);
             if (assemblyManifest.Identity.PublicKeyToken == null)
             {
                 downloader.ComponentVerifier.AddSimplyNamedAssemblyForVerification(e.FileLocalPath, assemblyManifest);
             }
             else
             {
                 downloader.ComponentVerifier.AddStrongNameAssemblyForVerification(e.FileLocalPath, assemblyManifest);
             }
         }
         else if (cookie.ManifestElement is System.Deployment.Application.Manifest.File)
         {
             System.Deployment.Application.Manifest.File file = (System.Deployment.Application.Manifest.File) cookie.ManifestElement;
             downloader.ComponentVerifier.AddFileForVerification(e.FileLocalPath, file.HashCollection);
         }
     }
 }
 internal static void SetDeploymentManifest(LogIdentity log, AssemblyManifest deploymentManifest)
 {
     Logger logger = GetLogger(log);
     if (logger != null)
     {
         lock (logger)
         {
             if (deploymentManifest.Identity != null)
             {
                 logger.Identities.DeploymentIdentity = deploymentManifest.Identity;
             }
             logger.Summary.DeploymentManifest = deploymentManifest;
         }
     }
 }
 public static AssemblyManifest DownloadApplicationManifest(AssemblyManifest deploymentManifest, string targetDir, Uri deploymentUri, out Uri appSourceUri, out string appManifestPath)
 {
     return DownloadApplicationManifest(deploymentManifest, targetDir, deploymentUri, null, null, out appSourceUri, out appManifestPath);
 }
 public SubscriptionState GetSubscriptionState(AssemblyManifest deployment)
 {
     return new SubscriptionState(this, deployment);
 }
 private static void ReorderFilesForIconFile(AssemblyManifest manifest, System.Deployment.Application.Manifest.File[] files)
 {
     if ((manifest.Description != null) && (manifest.Description.IconFile != null))
     {
         for (int i = 0; i < files.Length; i++)
         {
             if (string.Compare(files[i].NameFS, manifest.Description.IconFileFS, StringComparison.OrdinalIgnoreCase) == 0)
             {
                 if (i != 0)
                 {
                     System.Deployment.Application.Manifest.File file = files[0];
                     files[0] = files[i];
                     files[i] = file;
                 }
                 return;
             }
         }
     }
 }
 private static Uri MapFileSourceUri(AssemblyManifest deployManifest, Uri sourceUriBase, string fileName)
 {
     return UriHelper.UriFromRelativeFilePath(sourceUriBase, deployManifest.Deployment.MapFileExtensions ? (fileName + ".deploy") : fileName);
 }
 public SubscriptionState(System.Deployment.Application.SubscriptionStore subStore, AssemblyManifest deployment)
 {
     this.Initialize(subStore, deployment.Identity.ToSubscriptionId());
 }