Beispiel #1
0
 public ProgressPiece(UserInterfaceForm parentForm, UserInterfaceInfo info)
 {
     this._info = info;
     this.SuspendLayout();
     this.InitializeComponent();
     this.InitializeContent();
     this.ResumeLayout(false);
     parentForm.SuspendLayout();
     parentForm.SwitchUserInterfacePiece((FormPiece)this);
     parentForm.Text = string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("UI_ProgressTitle"), new object[2]
     {
         (object)0,
         (object)this._info.formTitle
     });
     parentForm.MinimizeBox   = true;
     parentForm.MaximizeBox   = false;
     parentForm.ControlBox    = true;
     this.lblHeader.Font      = new Font(this.lblHeader.Font, this.lblHeader.Font.Style | FontStyle.Bold);
     this.linkAppId.Font      = new Font(this.linkAppId.Font, this.linkAppId.Font.Style | FontStyle.Bold);
     this.lblFromId.Font      = new Font(this.lblFromId.Font, this.lblFromId.Font.Style | FontStyle.Bold);
     parentForm.ActiveControl = (Control)this.btnCancel;
     parentForm.ResumeLayout(false);
     parentForm.PerformLayout();
     parentForm.Visible         = true;
     this.updateUIMethodInvoker = new MethodInvoker(this.UpdateUI);
     this.disableMethodInvoker  = new MethodInvoker(this.Disable);
     this._parentForm           = parentForm;
 }
        public UserInterfaceModalResult ShowUpdate(UserInterfaceInfo info)
        {
            this.WaitReady();
            ManualResetEvent event2 = new ManualResetEvent(false);
            UpdatePiece      piece  = (UpdatePiece)this._uiForm.Invoke(new UserInterfaceForm.ConstructUpdatePieceDelegate(this._uiForm.ConstructUpdatePiece), new object[] { info, event2 });

            event2.WaitOne();
            return(piece.ModalResult);
        }
Beispiel #3
0
        public UserInterfaceModalResult ShowMaintenance(UserInterfaceInfo info, MaintenanceInfo maintenanceInfo)
        {
            this.WaitReady();
            ManualResetEvent manualResetEvent = new ManualResetEvent(false);
            MaintenancePiece maintenancePiece = (MaintenancePiece)this._uiForm.Invoke((Delegate) new UserInterfaceForm.ConstructMaintenancePieceDelegate(this._uiForm.ConstructMaintenancePiece), (object)info, (object)maintenanceInfo, (object)manualResetEvent);

            manualResetEvent.WaitOne();
            return(maintenancePiece.ModalResult);
        }
Beispiel #4
0
 public MaintenancePiece(UserInterfaceForm parentForm, UserInterfaceInfo info, MaintenanceInfo maintenanceInfo, ManualResetEvent modalEvent)
 {
     this._modalResult     = UserInterfaceModalResult.Cancel;
     this._info            = info;
     this._maintenanceInfo = maintenanceInfo;
     this._modalEvent      = modalEvent;
     this.SuspendLayout();
     this.InitializeComponent();
     this.InitializeContent();
     this.ResumeLayout(false);
     parentForm.SuspendLayout();
     parentForm.SwitchUserInterfacePiece((FormPiece)this);
     parentForm.Text          = this._info.formTitle;
     parentForm.MinimizeBox   = false;
     parentForm.MaximizeBox   = false;
     parentForm.ControlBox    = true;
     this.lblHeader.Font      = new Font(this.lblHeader.Font, this.lblHeader.Font.Style | FontStyle.Bold);
     parentForm.ActiveControl = (Control)this.btnCancel;
     parentForm.ResumeLayout(false);
     parentForm.PerformLayout();
     parentForm.Visible = true;
 }
 public MaintenancePiece(UserInterfaceForm parentForm, UserInterfaceInfo info, MaintenanceInfo maintenanceInfo, ManualResetEvent modalEvent)
 {
     base._modalResult = UserInterfaceModalResult.Cancel;
     this._info = info;
     this._maintenanceInfo = maintenanceInfo;
     base._modalEvent = modalEvent;
     base.SuspendLayout();
     this.InitializeComponent();
     this.InitializeContent();
     base.ResumeLayout(false);
     parentForm.SuspendLayout();
     parentForm.SwitchUserInterfacePiece(this);
     parentForm.Text = this._info.formTitle;
     parentForm.MinimizeBox = false;
     parentForm.MaximizeBox = false;
     parentForm.ControlBox = true;
     this.lblHeader.Font = new Font(this.lblHeader.Font, this.lblHeader.Font.Style | FontStyle.Bold);
     parentForm.ActiveControl = this.btnCancel;
     parentForm.ResumeLayout(false);
     parentForm.PerformLayout();
     parentForm.Visible = true;
 }
 public UpdatePiece(UserInterfaceForm parentForm, UserInterfaceInfo info, ManualResetEvent modalEvent)
 {
     this._info        = info;
     base._modalEvent  = modalEvent;
     base._modalResult = UserInterfaceModalResult.Cancel;
     base.SuspendLayout();
     this.InitializeComponent();
     this.InitializeContent();
     base.ResumeLayout(false);
     parentForm.SuspendLayout();
     parentForm.SwitchUserInterfacePiece(this);
     parentForm.Text          = this._info.formTitle;
     parentForm.MinimizeBox   = false;
     parentForm.MaximizeBox   = false;
     parentForm.ControlBox    = true;
     this.lblHeader.Font      = new Font(this.lblHeader.Font, this.lblHeader.Font.Style | FontStyle.Bold);
     this.linkAppId.Font      = new Font(this.linkAppId.Font, this.linkAppId.Font.Style | FontStyle.Bold);
     this.lblFromId.Font      = new Font(this.lblFromId.Font, this.lblFromId.Font.Style | FontStyle.Bold);
     parentForm.ActiveControl = this.btnOk;
     parentForm.ResumeLayout(false);
     parentForm.PerformLayout();
     parentForm.Visible = true;
 }
 public ProgressPiece(UserInterfaceForm parentForm, UserInterfaceInfo info)
 {
     this._info = info;
     base.SuspendLayout();
     this.InitializeComponent();
     this.InitializeContent();
     base.ResumeLayout(false);
     parentForm.SuspendLayout();
     parentForm.SwitchUserInterfacePiece(this);
     parentForm.Text = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_ProgressTitle"), new object[] { 0, this._info.formTitle });
     parentForm.MinimizeBox = true;
     parentForm.MaximizeBox = false;
     parentForm.ControlBox = true;
     this.lblHeader.Font = new Font(this.lblHeader.Font, this.lblHeader.Font.Style | FontStyle.Bold);
     this.linkAppId.Font = new Font(this.linkAppId.Font, this.linkAppId.Font.Style | FontStyle.Bold);
     this.lblFromId.Font = new Font(this.lblFromId.Font, this.lblFromId.Font.Style | FontStyle.Bold);
     parentForm.ActiveControl = this.btnCancel;
     parentForm.ResumeLayout(false);
     parentForm.PerformLayout();
     parentForm.Visible = true;
     this.updateUIMethodInvoker = new MethodInvoker(this.UpdateUI);
     this.disableMethodInvoker = new MethodInvoker(this.Disable);
     this._parentForm = parentForm;
 }
 public ProgressPiece ShowProgress(UserInterfaceInfo info)
 {
     this.WaitReady();
     return((ProgressPiece)this._uiForm.Invoke(new UserInterfaceForm.ConstructProgressPieceDelegate(this._uiForm.ConstructProgressPiece), new object[] { info }));
 }
Beispiel #9
0
 public UpdatePiece ConstructUpdatePiece(UserInterfaceInfo info, ManualResetEvent modalEvent)
 {
     return(new UpdatePiece(this, info, modalEvent));
 }
 private void MaintainSubscriptionInternal(string textualSubId)
 {
     bool flag = false;
     string[] strArray = new string[] { "Maintain_Exception", "Maintain_Completed", "Maintain_Failed", "Maintain_FailedMsg" };
     bool flag2 = false;
     Exception exception = null;
     bool flag3 = false;
     bool flag4 = false;
     string linkUrlMessage = Resources.GetString("ErrorMessage_GenericLinkUrlMessage");
     string linkUrl = null;
     string errorReportUrl = null;
     Logger.StartCurrentThreadLogging();
     Logger.SetTextualSubscriptionIdentity(textualSubId);
     using (UserInterface interface2 = new UserInterface())
     {
         MaintenanceInfo maintenanceInfo = new MaintenanceInfo();
         try
         {
             UserInterfaceInfo info = new UserInterfaceInfo();
             Logger.AddPhaseInformation(Resources.GetString("PhaseLog_StoreQueryForMaintenanceInfo"));
             SubscriptionState subscriptionState = this.GetSubscriptionState(textualSubId);
             try
             {
                 subscriptionState.SubscriptionStore.CheckInstalledAndShellVisible(subscriptionState);
                 if (subscriptionState.RollbackDeployment == null)
                 {
                     maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
                 }
                 else
                 {
                     maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RestorationPossible;
                     maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RestoreSelected;
                 }
                 AssemblyManifest currentDeploymentManifest = subscriptionState.CurrentDeploymentManifest;
                 if ((currentDeploymentManifest != null) && (currentDeploymentManifest.Description != null))
                 {
                     errorReportUrl = currentDeploymentManifest.Description.ErrorReportUrl;
                 }
                 Description effectiveDescription = subscriptionState.EffectiveDescription;
                 info.productName = effectiveDescription.Product;
                 info.supportUrl = effectiveDescription.SupportUrl;
                 info.formTitle = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_MaintenanceTitle"), new object[] { info.productName });
                 flag3 = true;
             }
             catch (DeploymentException exception2)
             {
                 flag3 = false;
                 Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_FailedStoreLookup"), exception2);
                 maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
             }
             catch (FormatException exception3)
             {
                 flag3 = false;
                 Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_FailedStoreLookup"), exception3);
                 maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
             }
             bool flag5 = false;
             if (flag3)
             {
                 if (interface2.ShowMaintenance(info, maintenanceInfo) == UserInterfaceModalResult.Ok)
                 {
                     flag5 = true;
                 }
             }
             else
             {
                 maintenanceInfo.maintenanceFlags = MaintenanceFlags.RemoveSelected;
                 flag5 = true;
             }
             if (flag5)
             {
                 flag2 = true;
                 if ((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RestoreSelected) != MaintenanceFlags.ClearFlag)
                 {
                     strArray = new string[] { "Rollback_Exception", "Rollback_Completed", "Rollback_Failed", "Rollback_FailedMsg" };
                     subscriptionState.SubscriptionStore.RollbackSubscription(subscriptionState);
                     flag2 = false;
                     interface2.ShowMessage(Resources.GetString("UI_RollbackCompletedMsg"), Resources.GetString("UI_RollbackCompletedTitle"));
                 }
                 else if ((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RemoveSelected) != MaintenanceFlags.ClearFlag)
                 {
                     strArray = new string[] { "Uninstall_Exception", "Uninstall_Completed", "Uninstall_Failed", "Uninstall_FailedMsg" };
                     try
                     {
                         subscriptionState.SubscriptionStore.UninstallSubscription(subscriptionState);
                         flag2 = false;
                     }
                     catch (DeploymentException exception4)
                     {
                         Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_UninstallFailed"), exception4);
                         flag4 = true;
                         ShellExposure.RemoveSubscriptionShellExposure(subscriptionState);
                         flag4 = false;
                     }
                 }
                 flag = true;
             }
         }
         catch (DeploymentException exception5)
         {
             Logger.AddErrorInformation(exception5, Resources.GetString(strArray[0]), new object[] { textualSubId });
             exception = exception5;
         }
         finally
         {
             Logger.AddPhaseInformation(Resources.GetString(flag ? strArray[1] : strArray[2]), new object[] { textualSubId });
             if ((((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RestoreSelected) != MaintenanceFlags.ClearFlag) && flag2) || ((((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RemoveSelected) != MaintenanceFlags.ClearFlag) && flag4) && flag2))
             {
                 string logFilePath = Logger.GetLogFilePath();
                 if (!Logger.FlushCurrentThreadLogs())
                 {
                     logFilePath = null;
                 }
                 if ((errorReportUrl != null) && (exception != null))
                 {
                     Exception innerMostException = this.GetInnerMostException(exception);
                     linkUrl = string.Format("{0}?outer={1}&&inner={2}&&msg={3}", new object[] { errorReportUrl, exception.GetType().ToString(), innerMostException.GetType().ToString(), innerMostException.Message });
                     if (linkUrl.Length > 0x800)
                     {
                         linkUrl = linkUrl.Substring(0, 0x800);
                     }
                 }
                 interface2.ShowError(Resources.GetString("UI_MaintenceErrorTitle"), Resources.GetString(strArray[3]), logFilePath, linkUrl, linkUrlMessage);
             }
             Logger.EndCurrentThreadLogging();
         }
     }
 }
 public UpdatePiece ConstructUpdatePiece(UserInterfaceInfo info, ManualResetEvent modalEvent)
 {
     return new UpdatePiece(this, info, modalEvent);
 }
 public ProgressPiece ConstructProgressPiece(UserInterfaceInfo info)
 {
     return new ProgressPiece(this, info);
 }
 public MaintenancePiece ConstructMaintenancePiece(UserInterfaceInfo info, MaintenanceInfo maintenanceInfo, ManualResetEvent modalEvent)
 {
     return new MaintenancePiece(this, info, maintenanceInfo, modalEvent);
 }
 private bool DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, long transactionId, out TempDirectory downloadTemp)
 {
     Uri uri;
     string str;
     bool flag = false;
     Logger.AddMethodCall("DownloadApplication called.");
     downloadTemp = this._subStore.AcquireTempDirectory();
     Logger.AddInternalState("Start processing application manifest.");
     AssemblyManifest appManifest = DownloadManager.DownloadApplicationManifest(actDesc.DeployManifest, downloadTemp.Path, actDesc.DeploySourceUri, out uri, out str);
     AssemblyManifest.ReValidateManifestSignatures(actDesc.DeployManifest, appManifest);
     if (appManifest.EntryPoints[0].HostInBrowser)
     {
         throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_HostInBrowserAppNotSupported"));
     }
     if (appManifest.EntryPoints[0].CustomHostSpecified)
     {
         throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_CustomHostSpecifiedAppNotSupported"));
     }
     if (appManifest.EntryPoints[0].CustomUX && (((actDesc.ActType == ActivationType.InstallViaDotApplication) || (actDesc.ActType == ActivationType.InstallViaFileAssociation)) || ((actDesc.ActType == ActivationType.InstallViaShortcut) || (actDesc.ActType == ActivationType.None))))
     {
         throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_CustomUXAppNotSupported"));
     }
     Logger.AddPhaseInformation(Resources.GetString("PhaseLog_ProcessingApplicationManifestComplete"));
     Logger.AddInternalState("Processing of application manifest has successfully completed.");
     actDesc.SetApplicationManifest(appManifest, uri, str);
     Logger.SetApplicationManifest(appManifest);
     this._subStore.CheckCustomUXFlag(subState, actDesc.AppManifest);
     actDesc.AppId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[] { actDesc.DeployManifest.Identity, actDesc.AppManifest.Identity });
     Logger.AddInternalState("Start request of trust and detection of platform.");
     if (appManifest.EntryPoints[0].CustomUX)
     {
         Logger.AddInternalState("This is a CustomUX application. Calling PersistTrustWithoutEvaluation.");
         actDesc.Trust = ApplicationTrust.PersistTrustWithoutEvaluation(actDesc.ToActivationContext());
     }
     else
     {
         this._ui.Hide();
         if (this._ui.SplashCancelled())
         {
             throw new DownloadCancelledException();
         }
         if (subState.IsInstalled && !string.Equals(subState.EffectiveCertificatePublicKeyToken, actDesc.EffectiveCertificatePublicKeyToken, StringComparison.Ordinal))
         {
             Logger.AddInternalState("EffectiveCertificatePublicKeyToken has changed between versions: subState.EffectiveCertificatePublicKeyToken=" + subState.EffectiveCertificatePublicKeyToken + ",actDesc.EffectiveCertificatePublicKeyToken=" + actDesc.EffectiveCertificatePublicKeyToken);
             Logger.AddInternalState("Removing the cached trust decision for CurrentBind.");
             ApplicationTrust.RemoveCachedTrust(subState.CurrentBind);
         }
         try
         {
             actDesc.Trust = ApplicationTrust.RequestTrust(subState, actDesc.DeployManifest.Deployment.Install, actDesc.IsUpdate, actDesc.ToActivationContext());
         }
         catch (Exception exception)
         {
             Logger.AddErrorInformation(Resources.GetString("Ex_DetermineTrustFailed"), exception);
             if (!(exception is TrustNotGrantedException))
             {
                 try
                 {
                     PlatformDetector.VerifyPlatformDependencies(actDesc.AppManifest, actDesc.DeployManifest, downloadTemp.Path);
                 }
                 catch (Exception exception2)
                 {
                     if (exception2 is DependentPlatformMissingException)
                     {
                         throw new DeploymentException(ExceptionTypes.TrustFailDependentPlatform, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("ErrorMessage_TrustFailDependentPlatformMissing"), new object[] { exception2.Message }), exception);
                     }
                 }
             }
             throw;
         }
     }
     this._fullTrust = actDesc.Trust.DefaultGrantSet.PermissionSet.IsUnrestricted();
     Logger.AddInternalState("_fullTrust = " + this._fullTrust.ToString());
     if (!this._fullTrust && (actDesc.AppManifest.FileAssociations.Length > 0))
     {
         throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_FileExtensionNotSupported"));
     }
     PlatformDetector.VerifyPlatformDependencies(actDesc.AppManifest, actDesc.DeployManifest, downloadTemp.Path);
     Logger.AddPhaseInformation(Resources.GetString("PhaseLog_PlatformDetectAndTrustGrantComplete"));
     Logger.AddInternalState("Request of trust and detection of platform is complete.");
     Logger.AddInternalState("Start downloading  and verifying dependencies.");
     if (!this._subStore.CheckAndReferenceApplication(subState, actDesc.AppId, transactionId))
     {
         flag = true;
         Description effectiveDescription = actDesc.EffectiveDescription;
         UserInterfaceInfo info = new UserInterfaceInfo {
             productName = effectiveDescription.Product
         };
         if (actDesc.IsUpdate)
         {
             if (actDesc.IsRequiredUpdate)
             {
                 info.formTitle = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_ProgressTitleRequiredUpdate"), new object[] { info.productName });
             }
             else
             {
                 info.formTitle = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_ProgressTitleUpdate"), new object[] { info.productName });
             }
         }
         else if (!actDesc.DeployManifest.Deployment.Install)
         {
             info.formTitle = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_ProgressTitleDownload"), new object[] { info.productName });
         }
         else
         {
             info.formTitle = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_ProgressTitleInstall"), new object[] { info.productName });
         }
         info.supportUrl = effectiveDescription.SupportUrl;
         info.sourceSite = UserInterface.GetDisplaySite(actDesc.DeploySourceUri);
         if ((appManifest.Description != null) && (appManifest.Description.IconFileFS != null))
         {
             info.iconFilePath = Path.Combine(downloadTemp.Path, appManifest.Description.IconFileFS);
         }
         ProgressPiece notification = this._ui.ShowProgress(info);
         DownloadOptions options = null;
         bool flag2 = !actDesc.DeployManifest.Deployment.Install;
         if (!this._fullTrust && flag2)
         {
             options = new DownloadOptions {
                 EnforceSizeLimit = true,
                 SizeLimit = this._subStore.GetSizeLimitInBytesForSemiTrustApps(),
                 Size = actDesc.DeployManifest.SizeInBytes + actDesc.AppManifest.SizeInBytes
             };
         }
         DownloadManager.DownloadDependencies(subState, actDesc.DeployManifest, actDesc.AppManifest, actDesc.AppSourceUri, downloadTemp.Path, null, notification, options);
         Logger.AddPhaseInformation(Resources.GetString("PhaseLog_DownloadDependenciesComplete"));
         actDesc.CommitApp = true;
         actDesc.AppPayloadPath = downloadTemp.Path;
         actDesc.AppGroup = null;
     }
     return flag;
 }
 private void ConsumeUpdatedDeployment(ref SubscriptionState subState, ActivationDescription actDesc)
 {
     DefinitionIdentity updateSkippedDeployment = actDesc.DeployManifest.Identity;
     Uri deploySourceUri = actDesc.DeploySourceUri;
     Logger.AddPhaseInformation(Resources.GetString("PhaseLog_ConsumeUpdatedDeployment"));
     Logger.AddInternalState("Consuming new update.");
     if (!actDesc.IsRequiredUpdate)
     {
         Logger.AddInternalState("Update is not a required update.");
         Description effectiveDescription = subState.EffectiveDescription;
         UserInterfaceInfo info = new UserInterfaceInfo {
             formTitle = Resources.GetString("UI_UpdateTitle"),
             productName = effectiveDescription.Product,
             supportUrl = effectiveDescription.SupportUrl,
             sourceSite = UserInterface.GetDisplaySite(deploySourceUri)
         };
         switch (this._ui.ShowUpdate(info))
         {
             case UserInterfaceModalResult.Skip:
             {
                 TimeSpan span = new TimeSpan(7, 0, 0, 0);
                 DateTime updateSkipTime = DateTime.UtcNow + span;
                 this._subStore.SetUpdateSkipTime(subState, updateSkippedDeployment, updateSkipTime);
                 Logger.AddPhaseInformation(Resources.GetString("Upd_DeployUpdateSkipping"));
                 Logger.AddInternalState("User has decided to skip the update.");
                 return;
             }
             case UserInterfaceModalResult.Cancel:
                 Logger.AddInternalState("Do not update now, but prompt for update on next activation.");
                 return;
         }
     }
     this.InstallApplication(ref subState, actDesc);
     Logger.AddPhaseInformation(Resources.GetString("Upd_Consumed"), new object[] { updateSkippedDeployment.ToString(), deploySourceUri });
     Logger.AddInternalState("Update consumed.");
 }
 public ProgressPiece ShowProgress(UserInterfaceInfo info)
 {
     this.WaitReady();
     return (ProgressPiece) this._uiForm.Invoke(new UserInterfaceForm.ConstructProgressPieceDelegate(this._uiForm.ConstructProgressPiece), new object[] { info });
 }
 public UserInterfaceModalResult ShowUpdate(UserInterfaceInfo info)
 {
     this.WaitReady();
     ManualResetEvent event2 = new ManualResetEvent(false);
     UpdatePiece piece = (UpdatePiece) this._uiForm.Invoke(new UserInterfaceForm.ConstructUpdatePieceDelegate(this._uiForm.ConstructUpdatePiece), new object[] { info, event2 });
     event2.WaitOne();
     return piece.ModalResult;
 }
Beispiel #18
0
 public MaintenancePiece ConstructMaintenancePiece(UserInterfaceInfo info, MaintenanceInfo maintenanceInfo, ManualResetEvent modalEvent)
 {
     return(new MaintenancePiece(this, info, maintenanceInfo, modalEvent));
 }
Beispiel #19
0
        private void MaintainSubscriptionInternal(string textualSubId)
        {
            bool flag1 = false;

            string[] strArray = new string[4]
            {
                "Maintain_Exception",
                "Maintain_Completed",
                "Maintain_Failed",
                "Maintain_FailedMsg"
            };
            bool      flag2          = false;
            Exception exception      = (Exception)null;
            bool      flag3          = false;
            string    linkUrlMessage = Resources.GetString("ErrorMessage_GenericLinkUrlMessage");
            string    linkUrl        = (string)null;
            string    str            = (string)null;

            Logger.StartCurrentThreadLogging();
            Logger.SetTextualSubscriptionIdentity(textualSubId);
            using (UserInterface userInterface = new UserInterface())
            {
                MaintenanceInfo maintenanceInfo = new MaintenanceInfo();
                try
                {
                    UserInterfaceInfo info = new UserInterfaceInfo();
                    Logger.AddPhaseInformation(Resources.GetString("PhaseLog_StoreQueryForMaintenanceInfo"));
                    SubscriptionState subscriptionState = this.GetSubscriptionState(textualSubId);
                    bool flag4;
                    try
                    {
                        subscriptionState.SubscriptionStore.CheckInstalledAndShellVisible(subscriptionState);
                        if (subscriptionState.RollbackDeployment == null)
                        {
                            maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
                        }
                        else
                        {
                            maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RestorationPossible;
                            maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RestoreSelected;
                        }
                        AssemblyManifest deploymentManifest = subscriptionState.CurrentDeploymentManifest;
                        if (deploymentManifest != null && deploymentManifest.Description != null)
                        {
                            str = deploymentManifest.Description.ErrorReportUrl;
                        }
                        Description effectiveDescription = subscriptionState.EffectiveDescription;
                        info.productName = effectiveDescription.Product;
                        info.supportUrl  = effectiveDescription.SupportUrl;
                        info.formTitle   = string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("UI_MaintenanceTitle"), new object[1]
                        {
                            (object)info.productName
                        });
                        flag4 = true;
                    }
                    catch (DeploymentException ex)
                    {
                        flag4 = false;
                        Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_FailedStoreLookup"), (Exception)ex);
                        maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
                    }
                    catch (FormatException ex)
                    {
                        flag4 = false;
                        Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_FailedStoreLookup"), (Exception)ex);
                        maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
                    }
                    bool flag5 = false;
                    if (flag4)
                    {
                        if (userInterface.ShowMaintenance(info, maintenanceInfo) == UserInterfaceModalResult.Ok)
                        {
                            flag5 = true;
                        }
                    }
                    else
                    {
                        maintenanceInfo.maintenanceFlags = MaintenanceFlags.RemoveSelected;
                        flag5 = true;
                    }
                    if (!flag5)
                    {
                        return;
                    }
                    flag2 = true;
                    if ((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RestoreSelected) != MaintenanceFlags.ClearFlag)
                    {
                        strArray = new string[4]
                        {
                            "Rollback_Exception",
                            "Rollback_Completed",
                            "Rollback_Failed",
                            "Rollback_FailedMsg"
                        };
                        subscriptionState.SubscriptionStore.RollbackSubscription(subscriptionState);
                        flag2 = false;
                        userInterface.ShowMessage(Resources.GetString("UI_RollbackCompletedMsg"), Resources.GetString("UI_RollbackCompletedTitle"));
                    }
                    else if ((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RemoveSelected) != MaintenanceFlags.ClearFlag)
                    {
                        strArray = new string[4]
                        {
                            "Uninstall_Exception",
                            "Uninstall_Completed",
                            "Uninstall_Failed",
                            "Uninstall_FailedMsg"
                        };
                        try
                        {
                            subscriptionState.SubscriptionStore.UninstallSubscription(subscriptionState);
                            flag2 = false;
                        }
                        catch (DeploymentException ex)
                        {
                            Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_UninstallFailed"), (Exception)ex);
                            flag3 = true;
                            ShellExposure.RemoveSubscriptionShellExposure(subscriptionState);
                            flag3 = false;
                        }
                    }
                    flag1 = true;
                }
                catch (DeploymentException ex)
                {
                    Logger.AddErrorInformation((Exception)ex, Resources.GetString(strArray[0]), new object[1]
                    {
                        (object)textualSubId
                    });
                    exception = (Exception)ex;
                }
                finally
                {
                    Logger.AddPhaseInformation(Resources.GetString(flag1 ? strArray[1] : strArray[2]), new object[1]
                    {
                        (object)textualSubId
                    });
                    if ((uint)(maintenanceInfo.maintenanceFlags & MaintenanceFlags.RestoreSelected) > 0U & flag2 || (maintenanceInfo.maintenanceFlags & MaintenanceFlags.RemoveSelected) != MaintenanceFlags.ClearFlag && flag3 & flag2)
                    {
                        string logFileLocation = Logger.GetLogFilePath();
                        if (!Logger.FlushCurrentThreadLogs())
                        {
                            logFileLocation = (string)null;
                        }
                        if (str != null && exception != null)
                        {
                            Exception innerMostException = this.GetInnerMostException(exception);
                            linkUrl = string.Format("{0}?outer={1}&&inner={2}&&msg={3}", new object[4]
                            {
                                (object)str,
                                (object)exception.GetType().ToString(),
                                (object)innerMostException.GetType().ToString(),
                                (object)innerMostException.Message
                            });
                            if (linkUrl.Length > 2048)
                            {
                                linkUrl = linkUrl.Substring(0, 2048);
                            }
                        }
                        userInterface.ShowError(Resources.GetString("UI_MaintenceErrorTitle"), Resources.GetString(strArray[3]), logFileLocation, linkUrl, linkUrlMessage);
                    }
                    Logger.EndCurrentThreadLogging();
                }
            }
        }
Beispiel #20
0
 public ProgressPiece ConstructProgressPiece(UserInterfaceInfo info)
 {
     return(new ProgressPiece(this, info));
 }