Пример #1
0
 private void OnBindCompleted(object sender, BindCompletedEventArgs e)
 {
     lock (this._lock)
     {
         GetManifestCompletedEventArgs local_2_1;
         try
         {
             this.AssertState(InPlaceHostingManager.State.GettingManifest, InPlaceHostingManager.State.Done);
             if (this._state != InPlaceHostingManager.State.Done)
             {
                 if (e.Cancelled || e.Error != null)
                 {
                     this.ChangeState(InPlaceHostingManager.State.Done);
                 }
                 else
                 {
                     this.ChangeState(InPlaceHostingManager.State.GetManifestSucceeded, (AsyncCompletedEventArgs)e);
                 }
             }
             // ISSUE: reference to a compiler-generated field
             if (this.GetManifestCompleted == null)
             {
                 return;
             }
             if (e.Error != null || e.Cancelled)
             {
                 if (e.Cancelled)
                 {
                     Logger.AddInternalState(this._log, "GetManifestAsync call cancelled.");
                 }
                 local_2_1 = new GetManifestCompletedEventArgs(e, this._deploymentManager.LogFilePath);
             }
             else
             {
                 this._isCached = e.IsCached;
                 bool local_3 = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.Install;
                 bool local_4 = this._deploymentManager.ActivationDescription.AppManifest.EntryPoints[0].HostInBrowser;
                 this._appType = this._deploymentManager.ActivationDescription.appType;
                 bool local_5 = this._deploymentManager.ActivationDescription.AppManifest.UseManifestForTrust;
                 Uri  local_6 = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.ProviderCodebaseUri;
                 local_2_1 = !this._isLaunchInHostProcess || this._appType == AppType.CustomHostSpecified || local_4 ? (!local_3 || !this._isLaunchInHostProcess && this._appType != AppType.CustomHostSpecified ? (!local_5 || this._appType != AppType.CustomHostSpecified ? (!(local_6 != (Uri)null) || this._appType != AppType.CustomHostSpecified ? (!local_4 || this._appType != AppType.CustomUX ? new GetManifestCompletedEventArgs(e, this._deploymentManager.ActivationDescription, this._deploymentManager.LogFilePath, this._log) : new GetManifestCompletedEventArgs(e, (Exception) new InvalidOperationException(Resources.GetString("Ex_CannotHaveCustomUXFlag")), this._deploymentManager.LogFilePath)) : new GetManifestCompletedEventArgs(e, (Exception) new InvalidOperationException(Resources.GetString("Ex_CannotHaveDeploymentProvider")), this._deploymentManager.LogFilePath)) : new GetManifestCompletedEventArgs(e, (Exception) new InvalidOperationException(Resources.GetString("Ex_CannotHaveUseManifestForTrustFlag")), this._deploymentManager.LogFilePath)) : new GetManifestCompletedEventArgs(e, (Exception) new InvalidOperationException(Resources.GetString("Ex_InstallFlagMustBeFalse")), this._deploymentManager.LogFilePath)) : new GetManifestCompletedEventArgs(e, (Exception) new InvalidOperationException(Resources.GetString("Ex_HostInBrowserFlagMustBeTrue")), this._deploymentManager.LogFilePath);
                 if (local_2_1.Error != null)
                 {
                     Logger.AddInternalState(this._log, "Exception thrown after binding: " + local_2_1.Error.GetType().ToString() + " : " + local_2_1.Error.Message + "\r\n" + local_2_1.Error.StackTrace);
                 }
             }
         }
         catch (Exception exception_0)
         {
             Logger.AddInternalState(this._log, "Exception thrown:" + exception_0.GetType().ToString() + " : " + exception_0.Message);
             this.ChangeState(InPlaceHostingManager.State.Done);
             throw;
         }
         // ISSUE: reference to a compiler-generated field
         this.GetManifestCompleted((object)this, local_2_1);
     }
 }
Пример #2
0
        private void BindAsyncCompleted(object arg)
        {
            BindCompletedEventArgs    e       = (BindCompletedEventArgs)arg;
            BindCompletedEventHandler handler = (BindCompletedEventHandler)this.Events[bindCompletedKey];

            if (handler != null)
            {
                handler(this, e);
            }
        }
Пример #3
0
        private void BindAsyncCompleted(object arg)
        {
            BindCompletedEventArgs    e = (BindCompletedEventArgs)arg;
            BindCompletedEventHandler completedEventHandler = (BindCompletedEventHandler)this.Events[DeploymentManager.bindCompletedKey];

            if (completedEventHandler == null)
            {
                return;
            }
            completedEventHandler((object)this, e);
        }
Пример #4
0
        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);
            }
        }
 internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, ActivationDescription activationDescription, string logFilePath, Logger.LogIdentity log) : base(e.Error, e.Cancelled, e.UserState)
 {
     this._applicationIdentity = (e.ActivationContext != null) ? e.ActivationContext.Identity : null;
     Logger.AddInternalState(log, "Creating GetManifestCompletedEventArgs.");
     string text = this._applicationIdentity.ToString();
     DefinitionAppId id = new DefinitionAppId(text);
     this._subId = id.DeploymentIdentity.ToSubscriptionId();
     this._logFilePath = logFilePath;
     this._isCached = e.IsCached;
     this._name = e.FriendlyName;
     this._actContext = e.ActivationContext;
     Logger.AddInternalState(log, "Application identity=" + text);
     Logger.AddInternalState(log, "Subscription identity=" + ((this._subId != null) ? this._subId.ToString() : "null"));
     Logger.AddInternalState(log, "IsCached=" + this._isCached.ToString());
     if (this._isCached)
     {
         this._rawDeploymentManifest = e.ActivationContext.DeploymentManifestBytes;
         this._rawApplicationManifest = e.ActivationContext.ApplicationManifestBytes;
     }
     this._activationDescription = activationDescription;
     this._version = this._activationDescription.AppId.DeploymentIdentity.Version;
     this._support = this._activationDescription.DeployManifest.Description.SupportUri;
 }
Пример #6
0
        internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, ActivationDescription activationDescription, string logFilePath, Logger.LogIdentity log)
            : base(e.Error, e.Cancelled, e.UserState)
        {
            this._applicationIdentity = e.ActivationContext != null ? e.ActivationContext.Identity : (ApplicationIdentity)null;
            Logger.AddInternalState(log, "Creating GetManifestCompletedEventArgs.");
            string text = this._applicationIdentity.ToString();

            this._subId       = new DefinitionAppId(text).DeploymentIdentity.ToSubscriptionId();
            this._logFilePath = logFilePath;
            this._isCached    = e.IsCached;
            this._name        = e.FriendlyName;
            this._actContext  = e.ActivationContext;
            Logger.AddInternalState(log, "Application identity=" + text);
            Logger.AddInternalState(log, "Subscription identity=" + (this._subId != null ? this._subId.ToString() : "null"));
            Logger.AddInternalState(log, "IsCached=" + this._isCached.ToString());
            if (this._isCached)
            {
                this._rawDeploymentManifest  = e.ActivationContext.DeploymentManifestBytes;
                this._rawApplicationManifest = e.ActivationContext.ApplicationManifestBytes;
            }
            this._activationDescription = activationDescription;
            this._version = this._activationDescription.AppId.DeploymentIdentity.Version;
            this._support = this._activationDescription.DeployManifest.Description.SupportUri;
        }
 internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, Exception error, string logFilePath) : base(error, e.Cancelled, e.UserState)
 {
     this._logFilePath = logFilePath;
 }
Пример #8
0
        private void UpdateBindCompletedEventHandler(object sender, BindCompletedEventArgs e)
        {
            Exception         error = (Exception)null;
            DeploymentManager dm    = (DeploymentManager)null;
            bool flag = false;

            new NamedPermissionSet("FullTrust").Assert();
            try
            {
                dm = (DeploymentManager)sender;
                if (e.Error == null && !e.Cancelled)
                {
                    UpdateCheckInfo updateCheckResult = this.DetermineUpdateCheckResult(dm.ActivationDescription);
                    if (updateCheckResult.UpdateAvailable)
                    {
                        dm.DeterminePlatformRequirements();
                        try
                        {
                            dm.DetermineTrust(new TrustParams()
                            {
                                NoPrompt = true
                            });
                        }
                        catch (TrustNotGrantedException ex)
                        {
                            if (!dm.ActivationDescription.IsUpdateInPKTGroup)
                            {
                                throw;
                            }
                        }
                    }
                    this.ProcessUpdateCheckResult(updateCheckResult, dm.ActivationDescription);
                    if (updateCheckResult.UpdateAvailable)
                    {
                        flag = true;
                        dm.SynchronizeAsync();
                    }
                    if (!dm.ActivationDescription.IsUpdateInPKTGroup)
                    {
                        return;
                    }
                    this._subState = this._subStore.GetSubscriptionState(dm.ActivationDescription.DeployManifest);
                }
                else
                {
                    error = e.Error;
                }
            }
            catch (Exception ex)
            {
                if (ExceptionUtility.IsHardException(ex))
                {
                    throw;
                }
                else
                {
                    error = ex;
                }
            }
            finally
            {
                CodeAccessPermission.RevertAssert();
                if (!flag)
                {
                    this.EndUpdateAsync(dm, error, e.Cancelled);
                }
            }
        }
Пример #9
0
        private void CheckForUpdateBindCompletedEventHandler(object sender, BindCompletedEventArgs e)
        {
            Exception         error             = (Exception)null;
            DeploymentManager deploymentManager = (DeploymentManager)null;
            bool    updateAvailable             = false;
            Version availableVersion            = (Version)null;
            bool    isUpdateRequired            = false;
            Version minimumRequiredVersion      = (Version)null;
            long    updateSize = 0;

            new NamedPermissionSet("FullTrust").Assert();
            try
            {
                deploymentManager = (DeploymentManager)sender;
                if (e.Error == null && !e.Cancelled)
                {
                    UpdateCheckInfo updateCheckResult = this.DetermineUpdateCheckResult(deploymentManager.ActivationDescription);
                    if (updateCheckResult.UpdateAvailable)
                    {
                        deploymentManager.DeterminePlatformRequirements();
                        try
                        {
                            deploymentManager.DetermineTrust(new TrustParams()
                            {
                                NoPrompt = true
                            });
                        }
                        catch (TrustNotGrantedException ex)
                        {
                            if (!deploymentManager.ActivationDescription.IsUpdateInPKTGroup)
                            {
                                throw;
                            }
                        }
                    }
                    this.ProcessUpdateCheckResult(updateCheckResult, deploymentManager.ActivationDescription);
                    if (!updateCheckResult.UpdateAvailable)
                    {
                        return;
                    }
                    updateAvailable        = true;
                    availableVersion       = updateCheckResult.AvailableVersion;
                    isUpdateRequired       = updateCheckResult.IsUpdateRequired;
                    minimumRequiredVersion = updateCheckResult.MinimumRequiredVersion;
                    updateSize             = updateCheckResult.UpdateSizeBytes;
                }
                else
                {
                    error = e.Error;
                }
            }
            catch (Exception ex)
            {
                if (ExceptionUtility.IsHardException(ex))
                {
                    throw;
                }
                else
                {
                    error = ex;
                }
            }
            finally
            {
                CodeAccessPermission.RevertAssert();
                Interlocked.Exchange(ref this._guard, 0);
                CheckForUpdateCompletedEventArgs    e1 = new CheckForUpdateCompletedEventArgs(error, e.Cancelled, (object)null, updateAvailable, availableVersion, isUpdateRequired, minimumRequiredVersion, updateSize);
                CheckForUpdateCompletedEventHandler completedEventHandler = (CheckForUpdateCompletedEventHandler)this.Events[ApplicationDeployment.checkForUpdateCompletedKey];
                if (completedEventHandler != null)
                {
                    completedEventHandler((object)this, e1);
                }
                if (deploymentManager != null)
                {
                    deploymentManager.ProgressChanged -= new DeploymentProgressChangedEventHandler(this.CheckForUpdateProgressChangedEventHandler);
                    deploymentManager.BindCompleted   -= new BindCompletedEventHandler(this.CheckForUpdateBindCompletedEventHandler);
                    new NamedPermissionSet("FullTrust").Assert();
                    try
                    {
                        deploymentManager.Dispose();
                    }
                    finally
                    {
                        CodeAccessPermission.RevertAssert();
                    }
                }
            }
        }
 private void OnBindCompleted(object sender, BindCompletedEventArgs e)
 {
     lock (this._lock)
     {
         GetManifestCompletedEventArgs args = null;
         try
         {
             this.AssertState(State.GettingManifest, State.Done);
             if (this._state != State.Done)
             {
                 if (e.Cancelled || (e.Error != null))
                 {
                     this.ChangeState(State.Done);
                 }
                 else
                 {
                     this.ChangeState(State.GetManifestSucceeded, e);
                 }
             }
             if (this.GetManifestCompleted == null)
             {
                 goto Label_0311;
             }
             if ((e.Error != null) || e.Cancelled)
             {
                 if (e.Cancelled)
                 {
                     Logger.AddInternalState(this._log, "GetManifestAsync call cancelled.");
                 }
                 args = new GetManifestCompletedEventArgs(e, this._deploymentManager.LogFilePath);
             }
             else
             {
                 this._isCached = e.IsCached;
                 bool install = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.Install;
                 bool hostInBrowser = this._deploymentManager.ActivationDescription.AppManifest.EntryPoints[0].HostInBrowser;
                 this._appType = this._deploymentManager.ActivationDescription.appType;
                 bool useManifestForTrust = this._deploymentManager.ActivationDescription.AppManifest.UseManifestForTrust;
                 Uri providerCodebaseUri = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.ProviderCodebaseUri;
                 if ((this._isLaunchInHostProcess && (this._appType != AppType.CustomHostSpecified)) && !hostInBrowser)
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_HostInBrowserFlagMustBeTrue")), this._deploymentManager.LogFilePath);
                 }
                 else if (install && (this._isLaunchInHostProcess || (this._appType == AppType.CustomHostSpecified)))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_InstallFlagMustBeFalse")), this._deploymentManager.LogFilePath);
                 }
                 else if (useManifestForTrust && (this._appType == AppType.CustomHostSpecified))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveUseManifestForTrustFlag")), this._deploymentManager.LogFilePath);
                 }
                 else if ((providerCodebaseUri != null) && (this._appType == AppType.CustomHostSpecified))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveDeploymentProvider")), this._deploymentManager.LogFilePath);
                 }
                 else if (hostInBrowser && (this._appType == AppType.CustomUX))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveCustomUXFlag")), this._deploymentManager.LogFilePath);
                 }
                 else
                 {
                     args = new GetManifestCompletedEventArgs(e, this._deploymentManager.ActivationDescription, this._deploymentManager.LogFilePath, this._log);
                 }
                 if (args.Error != null)
                 {
                     Logger.AddInternalState(this._log, "Exception thrown after binding: " + args.Error.GetType().ToString() + " : " + args.Error.Message + "\r\n" + args.Error.StackTrace);
                 }
             }
         }
         catch (Exception exception)
         {
             Logger.AddInternalState(this._log, "Exception thrown:" + exception.GetType().ToString() + " : " + exception.Message);
             this.ChangeState(State.Done);
             throw;
         }
         this.GetManifestCompleted(this, args);
     Label_0311:;
     }
 }
 private void OnBindCompleted(object sender, BindCompletedEventArgs e)
 {
     lock (this._lock)
     {
         GetManifestCompletedEventArgs args = null;
         try
         {
             this.AssertState(State.GettingManifest, State.Done);
             if (this._state != State.Done)
             {
                 if (e.Cancelled || (e.Error != null))
                 {
                     this.ChangeState(State.Done);
                 }
                 else
                 {
                     this.ChangeState(State.GetManifestSucceeded, e);
                 }
             }
             if (this.GetManifestCompleted == null)
             {
                 goto Label_0311;
             }
             if ((e.Error != null) || e.Cancelled)
             {
                 if (e.Cancelled)
                 {
                     Logger.AddInternalState(this._log, "GetManifestAsync call cancelled.");
                 }
                 args = new GetManifestCompletedEventArgs(e, this._deploymentManager.LogFilePath);
             }
             else
             {
                 this._isCached = e.IsCached;
                 bool install       = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.Install;
                 bool hostInBrowser = this._deploymentManager.ActivationDescription.AppManifest.EntryPoints[0].HostInBrowser;
                 this._appType = this._deploymentManager.ActivationDescription.appType;
                 bool useManifestForTrust = this._deploymentManager.ActivationDescription.AppManifest.UseManifestForTrust;
                 Uri  providerCodebaseUri = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.ProviderCodebaseUri;
                 if ((this._isLaunchInHostProcess && (this._appType != AppType.CustomHostSpecified)) && !hostInBrowser)
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_HostInBrowserFlagMustBeTrue")), this._deploymentManager.LogFilePath);
                 }
                 else if (install && (this._isLaunchInHostProcess || (this._appType == AppType.CustomHostSpecified)))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_InstallFlagMustBeFalse")), this._deploymentManager.LogFilePath);
                 }
                 else if (useManifestForTrust && (this._appType == AppType.CustomHostSpecified))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveUseManifestForTrustFlag")), this._deploymentManager.LogFilePath);
                 }
                 else if ((providerCodebaseUri != null) && (this._appType == AppType.CustomHostSpecified))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveDeploymentProvider")), this._deploymentManager.LogFilePath);
                 }
                 else if (hostInBrowser && (this._appType == AppType.CustomUX))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveCustomUXFlag")), this._deploymentManager.LogFilePath);
                 }
                 else
                 {
                     args = new GetManifestCompletedEventArgs(e, this._deploymentManager.ActivationDescription, this._deploymentManager.LogFilePath, this._log);
                 }
                 if (args.Error != null)
                 {
                     Logger.AddInternalState(this._log, "Exception thrown after binding: " + args.Error.GetType().ToString() + " : " + args.Error.Message + "\r\n" + args.Error.StackTrace);
                 }
             }
         }
         catch (Exception exception)
         {
             Logger.AddInternalState(this._log, "Exception thrown:" + exception.GetType().ToString() + " : " + exception.Message);
             this.ChangeState(State.Done);
             throw;
         }
         this.GetManifestCompleted(this, args);
         Label_0311 :;
     }
 }
 private void UpdateBindCompletedEventHandler(object sender, BindCompletedEventArgs e)
 {
     Exception error = null;
     DeploymentManager dm = null;
     bool flag = false;
     new NamedPermissionSet("FullTrust").Assert();
     try
     {
         dm = (DeploymentManager) sender;
         if ((e.Error == null) && !e.Cancelled)
         {
             UpdateCheckInfo info = this.DetermineUpdateCheckResult(dm.ActivationDescription);
             if (info.UpdateAvailable)
             {
                 dm.DeterminePlatformRequirements();
                 try
                 {
                     TrustParams trustParams = new TrustParams {
                         NoPrompt = true
                     };
                     dm.DetermineTrust(trustParams);
                 }
                 catch (TrustNotGrantedException)
                 {
                     if (!dm.ActivationDescription.IsUpdateInPKTGroup)
                     {
                         throw;
                     }
                 }
             }
             this.ProcessUpdateCheckResult(info, dm.ActivationDescription);
             if (info.UpdateAvailable)
             {
                 flag = true;
                 dm.SynchronizeAsync();
             }
             if (dm.ActivationDescription.IsUpdateInPKTGroup)
             {
                 this._subState = this._subStore.GetSubscriptionState(dm.ActivationDescription.DeployManifest);
             }
         }
         else
         {
             error = e.Error;
         }
     }
     catch (Exception exception2)
     {
         if (ExceptionUtility.IsHardException(exception2))
         {
             throw;
         }
         error = exception2;
     }
     finally
     {
         CodeAccessPermission.RevertAssert();
         if (!flag)
         {
             this.EndUpdateAsync(dm, error, e.Cancelled);
         }
     }
 }
 private void CheckForUpdateBindCompletedEventHandler(object sender, BindCompletedEventArgs e)
 {
     Exception error = null;
     DeploymentManager manager = null;
     bool updateAvailable = false;
     Version availableVersion = null;
     bool isUpdateRequired = false;
     Version minimumRequiredVersion = null;
     long updateSize = 0L;
     new NamedPermissionSet("FullTrust").Assert();
     try
     {
         manager = (DeploymentManager) sender;
         if ((e.Error == null) && !e.Cancelled)
         {
             UpdateCheckInfo info = this.DetermineUpdateCheckResult(manager.ActivationDescription);
             if (info.UpdateAvailable)
             {
                 manager.DeterminePlatformRequirements();
                 try
                 {
                     TrustParams trustParams = new TrustParams {
                         NoPrompt = true
                     };
                     manager.DetermineTrust(trustParams);
                 }
                 catch (TrustNotGrantedException)
                 {
                     if (!manager.ActivationDescription.IsUpdateInPKTGroup)
                     {
                         throw;
                     }
                 }
             }
             this.ProcessUpdateCheckResult(info, manager.ActivationDescription);
             if (info.UpdateAvailable)
             {
                 updateAvailable = true;
                 availableVersion = info.AvailableVersion;
                 isUpdateRequired = info.IsUpdateRequired;
                 minimumRequiredVersion = info.MinimumRequiredVersion;
                 updateSize = info.UpdateSizeBytes;
             }
         }
         else
         {
             error = e.Error;
         }
     }
     catch (Exception exception2)
     {
         if (ExceptionUtility.IsHardException(exception2))
         {
             throw;
         }
         error = exception2;
     }
     finally
     {
         CodeAccessPermission.RevertAssert();
         Interlocked.Exchange(ref this._guard, 0);
         CheckForUpdateCompletedEventArgs args = new CheckForUpdateCompletedEventArgs(error, e.Cancelled, null, updateAvailable, availableVersion, isUpdateRequired, minimumRequiredVersion, updateSize);
         CheckForUpdateCompletedEventHandler handler = (CheckForUpdateCompletedEventHandler) this.Events[checkForUpdateCompletedKey];
         if (handler != null)
         {
             handler(this, args);
         }
         if (manager != null)
         {
             manager.ProgressChanged -= new DeploymentProgressChangedEventHandler(this.CheckForUpdateProgressChangedEventHandler);
             manager.BindCompleted -= new BindCompletedEventHandler(this.CheckForUpdateBindCompletedEventHandler);
             new NamedPermissionSet("FullTrust").Assert();
             try
             {
                 manager.Dispose();
             }
             finally
             {
                 CodeAccessPermission.RevertAssert();
             }
         }
     }
 }
 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);
     }
 }
Пример #15
0
        private void CheckForUpdateBindCompletedEventHandler(object sender, BindCompletedEventArgs e)
        {
            Exception         error        = null;
            DeploymentManager manager      = null;
            bool    updateAvailable        = false;
            Version availableVersion       = null;
            bool    isUpdateRequired       = false;
            Version minimumRequiredVersion = null;
            long    updateSize             = 0L;

            new NamedPermissionSet("FullTrust").Assert();
            try
            {
                manager = (DeploymentManager)sender;
                if ((e.Error == null) && !e.Cancelled)
                {
                    UpdateCheckInfo info = this.DetermineUpdateCheckResult(manager.ActivationDescription);
                    if (info.UpdateAvailable)
                    {
                        manager.DeterminePlatformRequirements();
                        try
                        {
                            TrustParams trustParams = new TrustParams {
                                NoPrompt = true
                            };
                            manager.DetermineTrust(trustParams);
                        }
                        catch (TrustNotGrantedException)
                        {
                            if (!manager.ActivationDescription.IsUpdateInPKTGroup)
                            {
                                throw;
                            }
                        }
                    }
                    this.ProcessUpdateCheckResult(info, manager.ActivationDescription);
                    if (info.UpdateAvailable)
                    {
                        updateAvailable        = true;
                        availableVersion       = info.AvailableVersion;
                        isUpdateRequired       = info.IsUpdateRequired;
                        minimumRequiredVersion = info.MinimumRequiredVersion;
                        updateSize             = info.UpdateSizeBytes;
                    }
                }
                else
                {
                    error = e.Error;
                }
            }
            catch (Exception exception2)
            {
                if (ExceptionUtility.IsHardException(exception2))
                {
                    throw;
                }
                error = exception2;
            }
            finally
            {
                CodeAccessPermission.RevertAssert();
                Interlocked.Exchange(ref this._guard, 0);
                CheckForUpdateCompletedEventArgs    args    = new CheckForUpdateCompletedEventArgs(error, e.Cancelled, null, updateAvailable, availableVersion, isUpdateRequired, minimumRequiredVersion, updateSize);
                CheckForUpdateCompletedEventHandler handler = (CheckForUpdateCompletedEventHandler)this.Events[checkForUpdateCompletedKey];
                if (handler != null)
                {
                    handler(this, args);
                }
                if (manager != null)
                {
                    manager.ProgressChanged -= new DeploymentProgressChangedEventHandler(this.CheckForUpdateProgressChangedEventHandler);
                    manager.BindCompleted   -= new BindCompletedEventHandler(this.CheckForUpdateBindCompletedEventHandler);
                    new NamedPermissionSet("FullTrust").Assert();
                    try
                    {
                        manager.Dispose();
                    }
                    finally
                    {
                        CodeAccessPermission.RevertAssert();
                    }
                }
            }
        }
Пример #16
0
 internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, string logFilePath)
     : base(e.Error, e.Cancelled, e.UserState)
 {
     this._logFilePath = logFilePath;
 }