Exemplo n.º 1
0
 // Token: 0x06000111 RID: 273 RVA: 0x00006FE4 File Offset: 0x000051E4
 public override int Run()
 {
     ExSetupUI.exitCode = (ExitCode)base.Run();
     if (ExSetupUI.exitCode == ExitCode.Success)
     {
         bool flag = false;
         if (base.ParsedArguments.ContainsKey("mode"))
         {
             SetupOperations setupOperations = (SetupOperations)base.ParsedArguments["mode"];
             if (setupOperations == SetupOperations.Install || setupOperations == SetupOperations.Upgrade)
             {
                 flag = SetupLauncherHelper.IsRestart(base.ParsedArguments);
                 if (flag)
                 {
                     this.TryAddUpdatesParameterCopyMspFiles(SetupLauncherHelper.GetUpdatesDirFromRegistry(), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Temp\\ExchangeSetup\\MspTemp"), Path.Combine(SetupHelper.WindowsDir, "Temp\\ExchangeSetup"));
                 }
             }
         }
         SetupWizard mainForm = new SetupWizard(this, !flag, SetupLauncherHelper.IsExchangeInstalled());
         if (ExSetupUI.exitCode == ExitCode.Success)
         {
             SplashScreen.SplashInstance.Hide();
             Application.Run(mainForm);
         }
         SplashScreen.SplashInstance.CloseSplash();
     }
     return((int)ExSetupUI.exitCode);
 }
Exemplo n.º 2
0
        // Token: 0x06000112 RID: 274 RVA: 0x000070FC File Offset: 0x000052FC
        public override ExitCode ProcessArguments()
        {
            if (SetupLauncherHelper.IsFromInstalledExchangeDir() && this.IsInstallMode() && !this.IsLanguagePackMode() && !this.IsAddRolePossible())
            {
                this.ReportMessage(Strings.AddRoleNotPossible);
                return(ExitCode.Error);
            }
            bool flag = false;
            bool flag2;

            if (string.IsNullOrEmpty(SetupBase.SetupArgs.FirstOrDefault((string a) => a.ToLowerInvariant().IndexOf("addumlanguagepack") > 0)))
            {
                flag2 = string.IsNullOrEmpty(SetupBase.SetupArgs.FirstOrDefault((string a) => a.ToLowerInvariant().IndexOf("removeumlanguagepack") > 0));
            }
            else
            {
                flag2 = false;
            }
            bool flag3 = flag2;

            if (flag3)
            {
                flag = string.IsNullOrEmpty(SetupBase.SetupArgs.FirstOrDefault((string a) => a.ToLowerInvariant().IndexOf("mode") > 0));
            }
            if (flag)
            {
                SetupOperations setupOperations;
                if (base.IsExchangeInstalled)
                {
                    if (string.IsNullOrEmpty(SetupBase.SetupArgs.FirstOrDefault((string a) => a.ToLowerInvariant().IndexOf("removeumlanguagepack") > 0)))
                    {
                        string text = this.GetSourceDirFromArgs();
                        if (string.IsNullOrEmpty(text))
                        {
                            text = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                        }
                        string fullFileName = Path.Combine(Path.Combine(text, "Setup\\ServerRoles\\Common"), "ExSetup.exe");
                        int    num          = SetupLauncherHelper.CompareRunningVersionWithInstalledVersion(fullFileName);
                        if (num > 0)
                        {
                            this.ReportMessage(Strings.OlderVersionsOfServerRolesInstalled);
                            return(ExitCode.Error);
                        }
                        if (num < 0)
                        {
                            setupOperations = SetupOperations.Upgrade;
                            goto IL_167;
                        }
                        setupOperations = SetupOperations.Install;
                        goto IL_167;
                    }
                }
                setupOperations = SetupOperations.Install;
IL_167:
                this.AddArgument("mode", setupOperations.ToString());
            }
            return(base.ProcessArguments());
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        // Token: 0x06000119 RID: 281 RVA: 0x000072F8 File Offset: 0x000054F8
        internal void TryAddUpdatesParameterCopyMspFiles(string dirToCheck, string mspSourceDir, string destDir)
        {
            string text;
            string text2;

            SetupHelper.TryFindUpdates(dirToCheck, out text, out text2);
            if (text != null)
            {
                base.ParsedArguments["updatesdir"] = CommandLineParser.ParseSourceDir(dirToCheck);
                SetupLauncherHelper.CopyMspFiles(mspSourceDir, destDir);
            }
            if (text2 != null)
            {
                base.ParsedArguments["languagepack"] = CommandLineParser.ParseSourceFile(text2);
            }
        }
Exemplo n.º 5
0
        // Token: 0x0600000B RID: 11 RVA: 0x000021E8 File Offset: 0x000003E8
        public override int Run()
        {
            ExitCode exitCode = this.SetupChecks();

            if (exitCode == ExitCode.Error)
            {
                SetupLogger.Log(new LocalizedString("CurrentResult main.run:185: " + ExitCode.Error));
                return(1);
            }
            if (SetupBase.TheApp.ParsedArguments.ContainsKey("updatesdir"))
            {
                if (base.IsExchangeInstalled)
                {
                    this.ReportMessage(Strings.UpdatesNotOnFreshInstall);
                    SetupLogger.Log(new LocalizedString("CurrentResult main.run:196: " + ExitCode.Error));
                    return(1);
                }
                if (SetupLauncherHelper.IsRestart(SetupBase.TheApp.ParsedArguments))
                {
                    SetupLauncherHelper.CopyMspFiles(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Temp\\ExchangeSetup\\MspTemp"), Path.Combine(SetupHelper.WindowsDir, "Temp\\ExchangeSetup"));
                }
                else
                {
                    ExitCode exitCode2 = this.CheckForUpdates(SetupBase.TheApp.ParsedArguments);
                    if (exitCode2 != ExitCode.Success)
                    {
                        SetupLogger.Log(new LocalizedString("CurrentResult main.run:214: " + exitCode2));
                        return((int)exitCode2);
                    }
                }
            }
            if (!this.CopyFiles())
            {
                this.ReportMessage(Strings.FileCopyFailed(SetupBase.TheApp.SourceDir, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Temp\\ExchangeSetup")));
                SetupLogger.Log(new LocalizedString("CurrentResult main.run:223: " + ExitCode.Error));
                return(1);
            }
            int num = SetupLauncherHelper.LoadAssembly(SetupBase.SetupArgs, SetupBase.TheApp.ParsedArguments, SetupBase.TheApp, "Microsoft.Exchange.Setup.Console.dll", "Microsoft.Exchange.Setup.Console.Console");

            if (num == 1)
            {
                this.ReportMessage();
                this.ReportMessage(Strings.AdditionalErrorDetails);
            }
            SetupLogger.Log(new LocalizedString("CurrentResult main.run:235: " + num));
            return(num);
        }
Exemplo n.º 6
0
        // Token: 0x0600000C RID: 12 RVA: 0x0000237C File Offset: 0x0000057C
        public override ExitCode SetupChecks()
        {
            base.SetupChecks();
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = SetupLauncherHelper.AreEarlierVersionsOfServerRolesInstalled();

            if (flag)
            {
                stringBuilder.Append(Strings.EarlierVersionsExist);
            }
            if (SetupBase.TheApp.HasValidArgs == ExitCode.Error)
            {
                stringBuilder.Append(Strings.InvalidCommandLineArgs);
            }
            if (flag || SetupBase.TheApp.HasValidArgs == ExitCode.Error)
            {
                this.ReportMessage(Strings.SetupChecksFailed(stringBuilder.ToString()));
                this.ReportMessage(Strings.MoreInformationText);
                return(ExitCode.Error);
            }
            return(ExitCode.Success);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        // Token: 0x0600000E RID: 14 RVA: 0x00002698 File Offset: 0x00000898
        private bool CopyFiles()
        {
            bool flag = SetupLauncherHelper.IsFromInstalledExchangeDir();

            if (!base.IsExchangeInstalled || !flag)
            {
                this.ReportMessage(Strings.FileCopyText);
                bool flag2 = SetupLauncherHelper.CopyExSetupFiles(SetupBase.TheApp.SourceDir);
                if (!flag2)
                {
                    return(false);
                }
                if (Datacenter.IsMicrosoftHostedOnly(true))
                {
                    string path = "Setup\\ServerRoles\\ClientAccess\\ServicePlans".Split(new char[]
                    {
                        '\\'
                    }, 3)[2];
                    try
                    {
                        SetupHelper.CopyFiles(Path.Combine(SetupBase.TheApp.SourceDir, "Setup\\ServerRoles\\ClientAccess\\ServicePlans"), Path.Combine(SetupBase.TheApp.TargetDir, path), false);
                    }
                    catch (InsufficientDiskSpaceException)
                    {
                        SetupLogger.Log(Strings.InsufficientDiskSpace);
                        flag2 = false;
                    }
                    catch (FileNotExistsException ex)
                    {
                        SetupLogger.Log(Strings.FileCopyException(ex.Message));
                        flag2 = false;
                    }
                    if (!flag2)
                    {
                        return(false);
                    }
                    path = "Setup\\ServerRoles\\Mailbox".Split(new char[]
                    {
                        '\\'
                    })[2];
                    try
                    {
                        SetupHelper.CopyFiles(Path.Combine(SetupBase.TheApp.SourceDir, "Setup\\ServerRoles\\Mailbox"), Path.Combine(SetupBase.TheApp.TargetDir, path), false);
                    }
                    catch (InsufficientDiskSpaceException)
                    {
                        SetupLogger.Log(Strings.InsufficientDiskSpace);
                        flag2 = false;
                    }
                    catch (FileNotExistsException ex2)
                    {
                        SetupLogger.Log(Strings.FileCopyException(ex2.Message));
                        flag2 = false;
                    }
                    if (!flag2)
                    {
                        return(false);
                    }
                    this.ReportMessage(Strings.FileCopyComplete);
                    return(true);
                }
                else
                {
                    this.ReportMessage(Strings.FileCopyComplete);
                }
            }
            return(true);
        }