internal DeploymentProgressChangedEventArgs(int progressPercentage, object userState, long bytesCompleted, long bytesTotal, DeploymentProgressState state, string groupName) : base(progressPercentage, userState) { this._bytesCompleted = bytesCompleted; this._bytesTotal = bytesTotal; this._state = state; this._groupName = groupName; }
internal DownloadProgressChangedEventArgs(int progressPercentage, object userState, long bytesCompleted, long bytesTotal, DeploymentProgressState downloadProgressState) : base(progressPercentage, userState) { this._bytesCompleted = bytesCompleted; this._bytesTotal = bytesTotal; this._deploymentProgressState = downloadProgressState; }
public DeploymentProgressChangedEventArgs(long bytesCompleted, long bytesTotal, string group, DeploymentProgressState state, int progressPercentage, object userState) : base(progressPercentage, userState) { BytesCompleted = bytesCompleted; BytesTotal = bytesTotal; Group = group; State = state; }
// Constructor. internal DeploymentProgressChangedEventArgs (int progressPercentage, Object userState, long bytesCompleted, long bytesTotal, String group, DeploymentProgressState state) : base(progressPercentage, userState) { this.bytesCompleted = bytesCompleted; this.bytesTotal = bytesTotal; this.group = group; this.state = state; }
string GetProgressString(DeploymentProgressState state) { if (state == DeploymentProgressState.DownloadingApplicationFiles) { return("Uygulama Dosyaları"); } if (state == DeploymentProgressState.DownloadingApplicationInformation) { return("Uygulama Bilgileri"); } return("Güncelleme Bilgileri"); }
private string GetProgressString(DeploymentProgressState state) { if (state == DeploymentProgressState.DownloadingApplicationFiles) { return "application files"; } if (state == DeploymentProgressState.DownloadingApplicationInformation) { return "application manifest"; } return "deployment manifest"; }
private void BindAsyncWorker() { Exception error = null; bool cancelled = false; string productName = null; TempFile tempDeploy = null; TempDirectory tempAppDir = null; FileStream refTransaction = null; try { Logger.AddInternalState(this._log, "Binding started in a worker thread."); cancelled = this.BindCore(false, ref tempDeploy, ref tempAppDir, ref refTransaction, ref productName); Logger.AddInternalState(this._log, "Binding is successful."); } catch (Exception exception2) { if (ExceptionUtility.IsHardException(exception2)) { throw; } if (exception2 is DownloadCancelledException) { cancelled = true; } else { error = exception2; } } finally { this._state = DeploymentProgressState.DownloadingApplicationFiles; if ((error != null) || cancelled) { if (tempAppDir != null) { tempAppDir.Dispose(); } if (tempDeploy != null) { tempDeploy.Dispose(); } if (refTransaction != null) { refTransaction.Close(); } } BindCompletedEventArgs arg = new BindCompletedEventArgs(error, cancelled, null, this._actCtx, productName, this._cached); this.asyncOperation.Post(this.bindCompleted, arg); } }
static string GetProgressString(DeploymentProgressState state) { if (state == DeploymentProgressState.DownloadingApplicationFiles) { return("程序文件"); } else if (state == DeploymentProgressState.DownloadingApplicationInformation) { return("文件清单"); } else { return("文件部署清单"); } }
string GetProgressString(DeploymentProgressState state) { if (state == DeploymentProgressState.DownloadingApplicationFiles) { return("application files"); } else if (state == DeploymentProgressState.DownloadingApplicationInformation) { return("application manifest"); } else { return("deployment manifest"); } }
private string GetProgressString(DeploymentProgressState state) { switch (state) { case DeploymentProgressState.DownloadingApplicationFiles: return("application files"); case DeploymentProgressState.DownloadingApplicationInformation: return("application manifest"); case DeploymentProgressState.DownloadingDeploymentInformation: break; default: throw new ArgumentOutOfRangeException(nameof(state), state, null); } return("deployment manifest"); }
public ActivationContext Bind() { if (Interlocked.Exchange(ref this._bindGuard, 1) != 0) { throw new InvalidOperationException(Resources.GetString("Ex_BindOnce")); } bool flag = false; TempFile tempDeploy = null; TempDirectory tempAppDir = null; FileStream refTransaction = null; try { string productName = null; this.BindCore(true, ref tempDeploy, ref tempAppDir, ref refTransaction, ref productName); } catch (Exception) { flag = true; throw; } finally { this._state = DeploymentProgressState.DownloadingApplicationFiles; if (flag) { if (tempAppDir != null) { tempAppDir.Dispose(); } if (tempDeploy != null) { tempDeploy.Dispose(); } if (refTransaction != null) { refTransaction.Close(); } } } return(this._actCtx); }
internal DeploymentManager(Uri deploymentSource, bool isUpdate, bool isConfirmed, DownloadOptions downloadOptions, AsyncOperation optionalAsyncOp) { this._trustNotGrantedEvent = new ManualResetEvent(false); this._trustGrantedEvent = new ManualResetEvent(false); this._platformRequirementsFailedEvent = new ManualResetEvent(false); this._isConfirmed = true; this._state = DeploymentProgressState.DownloadingApplicationFiles; this._deploySource = deploymentSource; this._isupdate = isUpdate; this._isConfirmed = isConfirmed; this._downloadOptions = downloadOptions; this._events = new EventHandlerList(); this._syncGroupMap = CollectionsUtil.CreateCaseInsensitiveHashtable(); this._subStore = SubscriptionStore.CurrentUser; this.bindWorker = new ThreadStart(this.BindAsyncWorker); this.synchronizeWorker = new ThreadStart(this.SynchronizeAsyncWorker); this.synchronizeGroupWorker = new WaitCallback(this.SynchronizeGroupAsyncWorker); this.bindCompleted = new SendOrPostCallback(this.BindAsyncCompleted); this.synchronizeCompleted = new SendOrPostCallback(this.SynchronizeAsyncCompleted); this.progressReporter = new SendOrPostCallback(this.ProgressReporter); if (optionalAsyncOp == null) { this.asyncOperation = AsyncOperationManager.CreateOperation(null); } else { this.asyncOperation = optionalAsyncOp; } this._log = Logger.StartLogging(); if (deploymentSource != null) { Logger.SetSubscriptionUrl(this._log, deploymentSource); } this._assertApplicationReqEvents = new ManualResetEvent[] { this._trustNotGrantedEvent, this._platformRequirementsFailedEvent, this._trustGrantedEvent }; this._callerType = CallerType.Other; PolicyKeys.SkipApplicationDependencyHashCheck(); PolicyKeys.SkipDeploymentProvider(); PolicyKeys.SkipSchemaValidation(); PolicyKeys.SkipSemanticValidation(); PolicyKeys.SkipSignatureValidation(); }
private string GetProgressString(DeploymentProgressState state) { if (state == DeploymentProgressState.DownloadingApplicationFiles) { return "файлов приложения"; } else if (state == DeploymentProgressState.DownloadingApplicationInformation) { return "манифеста приложения"; } else { return "манифеста распространения"; } }
private bool BindCore(bool blocking, ref TempFile tempDeploy, ref TempDirectory tempAppDir, ref FileStream refTransaction, ref string productName) { try { if (this._deploySource == (Uri)null) { return(this.BindCoreWithAppId(blocking, ref refTransaction, ref productName)); } Uri deploySource = this._deploySource; this._state = DeploymentProgressState.DownloadingDeploymentInformation; Logger.AddInternalState(this._log, "Internal state=" + (object)this._state); AssemblyManifest assemblyManifest1 = DownloadManager.DownloadDeploymentManifest(this._subStore, ref deploySource, out tempDeploy, blocking ? (IDownloadNotification)null : (IDownloadNotification)this, this._downloadOptions); string path = tempDeploy.Path; ActivationDescription actDesc = new ActivationDescription(); actDesc.SetDeploymentManifest(assemblyManifest1, deploySource, path); Logger.SetDeploymentManifest(this._log, assemblyManifest1); actDesc.IsUpdate = this._isupdate; if (actDesc.DeployManifest.Deployment == null) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_NotDeploymentOrShortcut")); } if (!blocking && this._cancellationPending) { return(true); } long transactionId; refTransaction = this._subStore.AcquireReferenceTransaction(out transactionId); SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(actDesc.DeployManifest); if (actDesc.DeployManifest.Deployment.Install && actDesc.DeployManifest.Deployment.ProviderCodebaseUri == (Uri)null && (subscriptionState != null && subscriptionState.DeploymentProviderUri != (Uri)null) && !subscriptionState.DeploymentProviderUri.Equals((object)deploySource)) { throw new DeploymentException(ExceptionTypes.DeploymentUriDifferent, string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("Ex_DeploymentUriDifferentExText"), new object[3] { (object)actDesc.DeployManifest.Description.FilteredProduct, (object)deploySource.AbsoluteUri, (object)subscriptionState.DeploymentProviderUri.AbsoluteUri })); } DefinitionAppId appId; try { appId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[2] { actDesc.DeployManifest.Identity, new DefinitionIdentity(actDesc.DeployManifest.MainDependentAssembly.Identity) }); } catch (COMException ex) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), (Exception)ex); } catch (SEHException ex) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), (Exception)ex); } Logger.AddInternalState(this._log, "expectedAppId=" + appId.ToString()); bool flag1 = this._subStore.CheckAndReferenceApplication(subscriptionState, appId, transactionId); if (flag1 && appId.Equals((object)subscriptionState.CurrentBind)) { Logger.AddInternalState(this._log, "Application is found in store and it is the CurrentBind. Binding with appid."); this._bindAppId = appId; return(this.BindCoreWithAppId(blocking, ref refTransaction, ref productName)); } if (flag1) { Logger.AddInternalState(this._log, "Application is found in store but it is not the CurrentBind."); } else { Logger.AddInternalState(this._log, "Application is not found in store."); } if (!blocking && this._cancellationPending) { return(true); } this._state = DeploymentProgressState.DownloadingApplicationInformation; Logger.AddInternalState(this._log, "Internal state=" + (object)this._state); tempAppDir = this._subStore.AcquireTempDirectory(); Uri appSourceUri; string appManifestPath; AssemblyManifest assemblyManifest2 = DownloadManager.DownloadApplicationManifest(actDesc.DeployManifest, tempAppDir.Path, actDesc.DeploySourceUri, blocking ? (IDownloadNotification)null : (IDownloadNotification)this, this._downloadOptions, out appSourceUri, out appManifestPath); AssemblyManifest.ReValidateManifestSignatures(actDesc.DeployManifest, assemblyManifest2); Logger.SetApplicationManifest(this._log, assemblyManifest2); Logger.SetApplicationUrl(this._log, appSourceUri); actDesc.SetApplicationManifest(assemblyManifest2, appSourceUri, appManifestPath); actDesc.AppId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[2] { actDesc.DeployManifest.Identity, actDesc.AppManifest.Identity }); bool flag2 = this._subStore.CheckAndReferenceApplication(subscriptionState, actDesc.AppId, transactionId); if (!blocking && this._cancellationPending) { return(true); } Description effectiveDescription = actDesc.EffectiveDescription; productName = effectiveDescription.Product; this._cached = flag2; Logger.AddInternalState(this._log, "_cached=" + this._cached.ToString()); Logger.AddInternalState(this._log, "_isupdate=" + this._isupdate.ToString()); this._tempApplicationDirectory = tempAppDir; this._tempDeployment = tempDeploy; this._referenceTransaction = refTransaction; this._actCtx = DeploymentManager.ConstructActivationContext(actDesc); this._actDesc = actDesc; } catch (Exception ex) { this.LogError(Resources.GetString("Ex_FailedToDownloadManifest"), ex); Logger.AddInternalState(this._log, "Exception thrown in BindCore(): " + ex.GetType().ToString() + " : " + ex.Message + "\r\n" + ex.StackTrace); throw; } return(false); }
public ActivationContext Bind() { if (Interlocked.Exchange(ref this._bindGuard, 1) != 0) { throw new InvalidOperationException(Resources.GetString("Ex_BindOnce")); } bool flag = false; TempFile tempDeploy = null; TempDirectory tempAppDir = null; FileStream refTransaction = null; try { string productName = null; this.BindCore(true, ref tempDeploy, ref tempAppDir, ref refTransaction, ref productName); } catch (Exception) { flag = true; throw; } finally { this._state = DeploymentProgressState.DownloadingApplicationFiles; if (flag) { if (tempAppDir != null) { tempAppDir.Dispose(); } if (tempDeploy != null) { tempDeploy.Dispose(); } if (refTransaction != null) { refTransaction.Close(); } } } return this._actCtx; }
private bool BindCore(bool blocking, ref TempFile tempDeploy, ref TempDirectory tempAppDir, ref FileStream refTransaction, ref string productName) { try { long num; Uri uri2; string str2; if (this._deploySource == null) { return this.BindCoreWithAppId(blocking, ref refTransaction, ref productName); } bool flag = false; AssemblyManifest manifest = null; string manifestPath = null; Uri sourceUri = this._deploySource; this._state = DeploymentProgressState.DownloadingDeploymentInformation; Logger.AddInternalState(this._log, "Internal state=" + this._state); manifest = DownloadManager.DownloadDeploymentManifest(this._subStore, ref sourceUri, out tempDeploy, blocking ? null : this, this._downloadOptions); manifestPath = tempDeploy.Path; System.Deployment.Application.ActivationDescription actDesc = new System.Deployment.Application.ActivationDescription(); actDesc.SetDeploymentManifest(manifest, sourceUri, manifestPath); Logger.SetDeploymentManifest(this._log, manifest); actDesc.IsUpdate = this._isupdate; if (actDesc.DeployManifest.Deployment == null) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_NotDeploymentOrShortcut")); } if (!blocking && this._cancellationPending) { return true; } refTransaction = this._subStore.AcquireReferenceTransaction(out num); SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(actDesc.DeployManifest); if (((actDesc.DeployManifest.Deployment.Install && (actDesc.DeployManifest.Deployment.ProviderCodebaseUri == null)) && ((subscriptionState != null) && (subscriptionState.DeploymentProviderUri != null))) && !subscriptionState.DeploymentProviderUri.Equals(sourceUri)) { throw new DeploymentException(ExceptionTypes.DeploymentUriDifferent, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DeploymentUriDifferentExText"), new object[] { actDesc.DeployManifest.Description.FilteredProduct, sourceUri.AbsoluteUri, subscriptionState.DeploymentProviderUri.AbsoluteUri })); } DefinitionAppId appId = null; try { appId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[] { actDesc.DeployManifest.Identity, new DefinitionIdentity(actDesc.DeployManifest.MainDependentAssembly.Identity) }); } catch (COMException exception) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), exception); } catch (SEHException exception2) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), exception2); } Logger.AddInternalState(this._log, "expectedAppId=" + appId.ToString()); flag = this._subStore.CheckAndReferenceApplication(subscriptionState, appId, num); if (flag && appId.Equals(subscriptionState.CurrentBind)) { Logger.AddInternalState(this._log, "Application is found in store and it is the CurrentBind. Binding with appid."); this._bindAppId = appId; return this.BindCoreWithAppId(blocking, ref refTransaction, ref productName); } if (flag) { Logger.AddInternalState(this._log, "Application is found in store but it is not the CurrentBind."); } else { Logger.AddInternalState(this._log, "Application is not found in store."); } if (!blocking && this._cancellationPending) { return true; } this._state = DeploymentProgressState.DownloadingApplicationInformation; Logger.AddInternalState(this._log, "Internal state=" + this._state); tempAppDir = this._subStore.AcquireTempDirectory(); AssemblyManifest appManifest = DownloadManager.DownloadApplicationManifest(actDesc.DeployManifest, tempAppDir.Path, actDesc.DeploySourceUri, blocking ? null : this, this._downloadOptions, out uri2, out str2); AssemblyManifest.ReValidateManifestSignatures(actDesc.DeployManifest, appManifest); Logger.SetApplicationManifest(this._log, appManifest); Logger.SetApplicationUrl(this._log, uri2); actDesc.SetApplicationManifest(appManifest, uri2, str2); actDesc.AppId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[] { actDesc.DeployManifest.Identity, actDesc.AppManifest.Identity }); flag = this._subStore.CheckAndReferenceApplication(subscriptionState, actDesc.AppId, num); if (!blocking && this._cancellationPending) { return true; } Description effectiveDescription = actDesc.EffectiveDescription; productName = effectiveDescription.Product; this._cached = flag; Logger.AddInternalState(this._log, "_cached=" + this._cached.ToString()); Logger.AddInternalState(this._log, "_isupdate=" + this._isupdate.ToString()); this._tempApplicationDirectory = tempAppDir; this._tempDeployment = tempDeploy; this._referenceTransaction = refTransaction; this._actCtx = ConstructActivationContext(actDesc); this._actDesc = actDesc; } catch (Exception exception3) { this.LogError(Resources.GetString("Ex_FailedToDownloadManifest"), exception3); Logger.AddInternalState(this._log, "Exception thrown in BindCore(): " + exception3.GetType().ToString() + " : " + exception3.Message + "\r\n" + exception3.StackTrace); throw; } return false; }
private bool BindCore(bool blocking, ref TempFile tempDeploy, ref TempDirectory tempAppDir, ref FileStream refTransaction, ref string productName) { try { long num; Uri uri2; string str2; if (this._deploySource == null) { return(this.BindCoreWithAppId(blocking, ref refTransaction, ref productName)); } bool flag = false; AssemblyManifest manifest = null; string manifestPath = null; Uri sourceUri = this._deploySource; this._state = DeploymentProgressState.DownloadingDeploymentInformation; Logger.AddInternalState(this._log, "Internal state=" + this._state); manifest = DownloadManager.DownloadDeploymentManifest(this._subStore, ref sourceUri, out tempDeploy, blocking ? null : this, this._downloadOptions); manifestPath = tempDeploy.Path; System.Deployment.Application.ActivationDescription actDesc = new System.Deployment.Application.ActivationDescription(); actDesc.SetDeploymentManifest(manifest, sourceUri, manifestPath); Logger.SetDeploymentManifest(this._log, manifest); actDesc.IsUpdate = this._isupdate; if (actDesc.DeployManifest.Deployment == null) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_NotDeploymentOrShortcut")); } if (!blocking && this._cancellationPending) { return(true); } refTransaction = this._subStore.AcquireReferenceTransaction(out num); SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(actDesc.DeployManifest); if (((actDesc.DeployManifest.Deployment.Install && (actDesc.DeployManifest.Deployment.ProviderCodebaseUri == null)) && ((subscriptionState != null) && (subscriptionState.DeploymentProviderUri != null))) && !subscriptionState.DeploymentProviderUri.Equals(sourceUri)) { throw new DeploymentException(ExceptionTypes.DeploymentUriDifferent, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DeploymentUriDifferentExText"), new object[] { actDesc.DeployManifest.Description.FilteredProduct, sourceUri.AbsoluteUri, subscriptionState.DeploymentProviderUri.AbsoluteUri })); } DefinitionAppId appId = null; try { appId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[] { actDesc.DeployManifest.Identity, new DefinitionIdentity(actDesc.DeployManifest.MainDependentAssembly.Identity) }); } catch (COMException exception) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), exception); } catch (SEHException exception2) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), exception2); } Logger.AddInternalState(this._log, "expectedAppId=" + appId.ToString()); flag = this._subStore.CheckAndReferenceApplication(subscriptionState, appId, num); if (flag && appId.Equals(subscriptionState.CurrentBind)) { Logger.AddInternalState(this._log, "Application is found in store and it is the CurrentBind. Binding with appid."); this._bindAppId = appId; return(this.BindCoreWithAppId(blocking, ref refTransaction, ref productName)); } if (flag) { Logger.AddInternalState(this._log, "Application is found in store but it is not the CurrentBind."); } else { Logger.AddInternalState(this._log, "Application is not found in store."); } if (!blocking && this._cancellationPending) { return(true); } this._state = DeploymentProgressState.DownloadingApplicationInformation; Logger.AddInternalState(this._log, "Internal state=" + this._state); tempAppDir = this._subStore.AcquireTempDirectory(); AssemblyManifest appManifest = DownloadManager.DownloadApplicationManifest(actDesc.DeployManifest, tempAppDir.Path, actDesc.DeploySourceUri, blocking ? null : this, this._downloadOptions, out uri2, out str2); AssemblyManifest.ReValidateManifestSignatures(actDesc.DeployManifest, appManifest); Logger.SetApplicationManifest(this._log, appManifest); Logger.SetApplicationUrl(this._log, uri2); actDesc.SetApplicationManifest(appManifest, uri2, str2); actDesc.AppId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[] { actDesc.DeployManifest.Identity, actDesc.AppManifest.Identity }); flag = this._subStore.CheckAndReferenceApplication(subscriptionState, actDesc.AppId, num); if (!blocking && this._cancellationPending) { return(true); } Description effectiveDescription = actDesc.EffectiveDescription; productName = effectiveDescription.Product; this._cached = flag; Logger.AddInternalState(this._log, "_cached=" + this._cached.ToString()); Logger.AddInternalState(this._log, "_isupdate=" + this._isupdate.ToString()); this._tempApplicationDirectory = tempAppDir; this._tempDeployment = tempDeploy; this._referenceTransaction = refTransaction; this._actCtx = ConstructActivationContext(actDesc); this._actDesc = actDesc; } catch (Exception exception3) { this.LogError(Resources.GetString("Ex_FailedToDownloadManifest"), exception3); Logger.AddInternalState(this._log, "Exception thrown in BindCore(): " + exception3.GetType().ToString() + " : " + exception3.Message + "\r\n" + exception3.StackTrace); throw; } return(false); }
private string GetProgressString(DeploymentProgressState state) { if (state == DeploymentProgressState.DownloadingApplicationFiles) return "files"; if (state == DeploymentProgressState.DownloadingApplicationInformation) return "metadata"; return "manifest"; }