Esempio n. 1
0
        // Token: 0x0600000D RID: 13 RVA: 0x0000241C File Offset: 0x0000061C
        internal ExitCode CheckForUpdates(Dictionary <string, object> parsedArguments)
        {
            string pathName = ((LongPath)parsedArguments["sourcedir"]).PathName;

            if (!Directory.Exists(pathName))
            {
                this.ReportMessage(Strings.SetupChecksFailed(Strings.NoUpdates));
                SetupLogger.Log(new LocalizedString("CurrentResult main.checkforupdates:283: " + ExitCode.Error));
                return(ExitCode.Error);
            }
            string pathName2 = ((LongPath)parsedArguments["updatesdir"]).PathName;

            if (!Directory.Exists(pathName2))
            {
                this.ReportMessage(Strings.SetupChecksFailed(Strings.NoUpdates));
                SetupLogger.Log(new LocalizedString("CurrentResult main.checkforupdates:292: " + ExitCode.Error));
                return(ExitCode.Error);
            }
            string text = Path.Combine(pathName, "ExchangeServer.msi");

            if (!File.Exists(text))
            {
                this.ReportMessage(Strings.SetupChecksFailed(Strings.NoUpdates));
                SetupLogger.Log(new LocalizedString("CurrentResult main.checkforupdates:300: " + ExitCode.Error));
                return(ExitCode.Error);
            }
            string[] files = Directory.GetFiles(pathName2, "*.msp", SearchOption.TopDirectoryOnly);
            if (files.Length == 0)
            {
                this.ReportMessage(Strings.SetupChecksFailed(Strings.NoUpdates));
                SetupLogger.Log(new LocalizedString("CurrentResult main.checkforupdates:308: " + ExitCode.Error));
                return(ExitCode.Error);
            }
            using (MspValidator mspValidator = new MspValidator(files, text, null, null, new Action <object>(this.ReportMessageCallback)))
            {
                if (!mspValidator.Validate())
                {
                    this.ReportMessage(Strings.SetupChecksFailed(Strings.InvalidUpdates));
                    SetupLogger.Log(new LocalizedString("CurrentResult main.checkforupdates:344: " + ExitCode.Error));
                    return(ExitCode.Error);
                }
                List <string> validatedFiles = mspValidator.ValidatedFiles;
                string        text2          = validatedFiles.LastOrDefault((string x) => !string.IsNullOrEmpty(x) && MsiHelper.IsMspFileExtension(x));
                if (!string.IsNullOrEmpty(text2))
                {
                    string text3 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Temp\\ExchangeSetup\\MspTemp");
                    MspUtility.UnpackMspCabs(text2, text3);
                    if (SetupLauncherHelper.SetupRequiredFilesUpdated(SetupChecksFileConstant.GetSetupRequiredFiles(), SetupHelper.GetSetupRequiredFilesFromAssembly(text3), text3))
                    {
                        this.ReportMessage(Strings.RestartSetup);
                        SetupLogger.Log(new LocalizedString("CurrentResult main.checkforupdates:336: " + ExitCode.Restart));
                        return(ExitCode.Restart);
                    }
                }
            }
            SetupLogger.Log(new LocalizedString("CurrentResult main.checkforupdates:349: " + ExitCode.Success));
            return(ExitCode.Success);
        }
Esempio n. 2
0
        // Token: 0x060001F1 RID: 497 RVA: 0x0000BA34 File Offset: 0x00009C34
        private void VerifyAndSetRegistry(object checkPath)
        {
            if (base.InvokeRequired)
            {
                base.Invoke(new UpdatesDownloadsPage.VerifyAndSetRegistryDelegate(this.VerifyAndSetRegistry), new object[]
                {
                    checkPath
                });
                return;
            }
            string text = (string)checkPath;
            string languagePackBundleFileName = Path.Combine(text, "LanguagePackBundle.exe");
            bool   flag  = true;
            string value = string.Empty;

            if (File.Exists(languagePackBundleFileName))
            {
                using (LanguagePackValidator languagePackValidator = new LanguagePackValidator(languagePackBundleFileName, this.localXMLVersioningPath, new Action <object>(this.UpdateDownloadUpdatesStatusBox)))
                {
                    flag = languagePackValidator.Validate();
                    if (flag)
                    {
                        value = languagePackValidator.ValidatedFiles.FirstOrDefault((string x) => x.Equals(languagePackBundleFileName, StringComparison.InvariantCultureIgnoreCase));
                    }
                    goto IL_C2;
                }
            }
            languagePackBundleFileName = null;
IL_C2:
            bool flag2 = true;
            string text2 = string.Empty;

            if (Directory.Exists(text))
            {
                string[] files = Directory.GetFiles(text, "*.msp", SearchOption.TopDirectoryOnly);
                if (files.Length != 0)
                {
                    using (MspValidator mspValidator = new MspValidator(files, Path.Combine(this.sourceDir, "EXCHANGESERVER.msi"), languagePackBundleFileName, File.Exists(this.localXMLVersioningPath) ? this.localXMLVersioningPath : null, new Action <object>(this.UpdateDownloadUpdatesStatusBox)))
                    {
                        flag2 = mspValidator.Validate();
                        if (flag2)
                        {
                            text2 = mspValidator.ValidatedFiles.LastOrDefault((string x) => !string.IsNullOrEmpty(x) && MsiHelper.IsMspFileExtension(x));
                        }
                    }
                }
            }
            bool flag3 = !string.IsNullOrEmpty(value);
            bool flag4 = !string.IsNullOrEmpty(text2);
            bool flag5 = false;

            if (flag && flag2)
            {
                flag5 = (text.Equals(this.saveToDirectory, StringComparison.InvariantCultureIgnoreCase) || this.MoveToSaveToPath());
            }
            bool flag6 = false;

            if (flag5)
            {
                flag6 = this.SetRegistryKeyForBundle();
            }
            if (flag6)
            {
                bool   flag7 = false;
                string text3 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Temp\\ExchangeSetup\\MspTemp");
                if (flag4)
                {
                    MspUtility.UnpackMspCabs(Path.Combine(this.saveToDirectory, Path.GetFileName(text2)), text3);
                    flag7 = SetupLauncherHelper.SetupRequiredFilesUpdated(SetupChecksFileConstant.GetSetupRequiredFiles(), SetupHelper.GetSetupRequiredFilesFromAssembly(text3), text3);
                }
                if (flag7 || flag3)
                {
                    ExSetupUI.ExitApplication(ExitCode.Restart);
                }
                else if (flag4)
                {
                    SetupLauncherHelper.CopyMspFiles(text3, Path.Combine(SetupHelper.WindowsDir, "Temp\\ExchangeSetup"));
                }
                this.UpdateDownloadUpdatesStatusBox(Strings.DownloadInstallationCompleted);
                base.SetWizardButtons(WizardButtons.Next);
                base.SetVisibleWizardButtons(WizardButtons.Next);
                return;
            }
            this.customProgressBarWithTitle.TitleOnly = true;
            this.UpdateDownloadUpdatesStatusBox(Strings.FinishedWithError(new LocalizedString(Logger.PathToFileLog)));
            base.SetVisibleWizardButtons(WizardButtons.Previous | WizardButtons.Next);
            base.SetWizardButtons(WizardButtons.Previous);
        }