Exemple #1
0
 // Token: 0x06000152 RID: 338 RVA: 0x00007AB0 File Offset: 0x00005CB0
 internal void CopyFiles()
 {
     try
     {
         this.totalFileSpaceCopied = 0L;
         SetupLogger.Log(Strings.CopyingDirectoryFromTo(this.sourceDirectory, this.destinationDirectory));
         DirectoryInfo directoryInfo            = new DirectoryInfo(this.sourceDirectory);
         IEnumerable <DirectoryInfo> collection = directoryInfo.EnumerateDirectories("*", SearchOption.AllDirectories);
         List <DirectoryInfo>        list       = new List <DirectoryInfo>(collection);
         list.Add(directoryInfo);
         this.totalDiskSpaceNeeded = this.GetTotalFilesSize(list);
         SetupLogger.Log(Strings.DiskSpaceRequired(this.totalDiskSpaceNeeded.ToString()));
         if (this.totalDiskSpaceNeeded == 0L)
         {
             SetupLogger.Log(Strings.NoFilesToCopy(this.sourceDirectory));
             throw new FileCopierReadFileException(this.sourceDirectory);
         }
         long freeDiskSpace = this.GetFreeDiskSpace();
         SetupLogger.Log(Strings.DiskSpaceAvailable(freeDiskSpace.ToString()));
         if (freeDiskSpace < this.totalDiskSpaceNeeded)
         {
             SetupLogger.Log(Strings.InsufficientDiskSpace);
             throw new FileCopierInsufficientDiskSpaceException();
         }
         foreach (DirectoryInfo directoryInfo2 in list)
         {
             if (!this.excludePaths.Contains(directoryInfo2.Name.ToLower()))
             {
                 string text = directoryInfo2.FullName.Replace(this.sourceDirectory, this.destinationDirectory);
                 if (!Directory.Exists(text))
                 {
                     Directory.CreateDirectory(text);
                 }
                 foreach (FileInfo fileInfo in directoryInfo2.GetFiles())
                 {
                     string text2 = string.Format("{0}\\{1}", text, fileInfo.Name);
                     this.CurrentFileName = fileInfo.Name;
                     this.FileCopierBeforeFileCopyEvent();
                     if (!File.Exists(text2))
                     {
                         fileInfo.CopyTo(text2);
                     }
                     this.TotalFileCopied++;
                     this.totalFileSpaceCopied += fileInfo.Length;
                     this.FileCopierProgressEvent();
                     if (this.cancelFileCopy)
                     {
                         break;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SetupLogger.LogError(ex);
         this.FindErrorTypeAndNotify(ex);
     }
 }
Exemple #2
0
 // Token: 0x06000153 RID: 339 RVA: 0x00007CE0 File Offset: 0x00005EE0
 private void DeleteTempFiles()
 {
     SetupLogger.Log(Strings.DeletingTempFiles);
     if (Directory.Exists(this.destinationDirectory))
     {
         Directory.Delete(this.destinationDirectory, true);
     }
 }
Exemple #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);
        }
 // Token: 0x06000044 RID: 68 RVA: 0x00002B18 File Offset: 0x00000D18
 private void CheckForUpdatesPage_CheckLoaded(object sender, CancelEventArgs e)
 {
     Control[] array = base.Controls.Find(this.checkForUpdateYesRadioButton.Name, true);
     if (array.Length > 0)
     {
         this.OnSetLoaded(new CancelEventArgs());
         SetupLogger.Log(Strings.PageLoaded(base.Name));
     }
 }
Exemple #5
0
 // Token: 0x060001E6 RID: 486 RVA: 0x0000B390 File Offset: 0x00009590
 private void UpdatesDownloadsPage_CheckLoaded(object sender, CancelEventArgs e)
 {
     Control[] array = base.Controls.Find(this.customProgressBarWithTitle.Name, true);
     if (array.Length > 0)
     {
         this.OnSetLoaded(new CancelEventArgs());
         SetupLogger.Log(Strings.PageLoaded(base.Name));
     }
 }
 // Token: 0x0600016B RID: 363 RVA: 0x000082BC File Offset: 0x000064BC
 private void InitializingSetupPage_CheckLoaded(object sender, CancelEventArgs e)
 {
     Control[] array = base.Controls.Find(this.setupInitializingLabel.Name, true);
     if (array.Length > 0)
     {
         this.OnSetLoaded(new CancelEventArgs());
         SetupLogger.Log(Strings.PageLoaded(base.Name));
     }
 }
 // Token: 0x06000052 RID: 82 RVA: 0x00003810 File Offset: 0x00001A10
 private void CopyFilesPage_CheckLoaded(object sender, CancelEventArgs e)
 {
     Control[] array = base.Controls.Find(this.copyFilesLabel.Name, true);
     if (array.Length > 0)
     {
         this.OnSetLoaded(new CancelEventArgs());
         SetupLogger.Log(Strings.PageLoaded(base.Name));
         base.SetTopMost(false);
     }
 }
        // Token: 0x060001D4 RID: 468 RVA: 0x0000AD58 File Offset: 0x00008F58
        private static void ThrowAssemblyLoadFileNotFoundException(SetupBase theApp, string exSetupGUIDllLocation)
        {
            string setupArgs = string.Empty;

            if (SetupBase.SetupArgs != null && SetupBase.SetupArgs.Length > 0)
            {
                setupArgs = string.Join(".", SetupBase.SetupArgs);
            }
            SetupLogger.Log(Strings.AssemblyLoadFileNotFound(exSetupGUIDllLocation, setupArgs, theApp.SourceDir, theApp.TargetDir, theApp.IsExchangeInstalled));
            throw new AssemblyLoadFileNotFoundException();
        }
Exemple #9
0
 private void LogUserName()
 {
     try
     {
         WindowsPrincipal windowsPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
         string           name             = windowsPrincipal.Identity.Name;
         SetupLogger.Log(Strings.UserName(name));
     }
     catch (SecurityException ex)
     {
         this.LogWarning(Strings.UserNameError(ex.Message));
     }
 }
Exemple #10
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);
        }
Exemple #11
0
 // Token: 0x0600014D RID: 333 RVA: 0x000078D8 File Offset: 0x00005AD8
 public void StartFileCopying()
 {
     SetupLogger.Log(Strings.StartFileCopying);
     this.cancelFileCopy  = false;
     this.TotalFileCopied = 0;
     this.CopyFiles();
     if (this.cancelFileCopy)
     {
         try
         {
             this.DeleteTempFiles();
         }
         catch (Exception e)
         {
             SetupLogger.LogError(e);
         }
         this.FileCopierCancelEvent();
     }
     else
     {
         this.FileCopierCompletedEvent();
     }
     SetupLogger.Log(Strings.FileCopyingFinished);
 }
        // Token: 0x06000054 RID: 84 RVA: 0x0000387C File Offset: 0x00001A7C
        private void FileCopierUpdatesStatus(object message)
        {
            if (base.InvokeRequired)
            {
                base.Invoke(new CopyFilesPage.UpdateFileCopyingStatus(this.FileCopierUpdatesStatus), new object[]
                {
                    message
                });
                return;
            }
            string text = null;

            if (message is ILocalizedString)
            {
                text = message.ToString();
                SetupLogger.Log((LocalizedString)message);
            }
            else if (message is FileCopierInsufficientDiskSpaceException)
            {
                FileCopierInsufficientDiskSpaceException e = (FileCopierInsufficientDiskSpaceException)message;
                SetupLogger.LogError(e);
                text = Strings.InsufficientDiskSpace.ToString();
            }
            else if (message is FileCopierReadFileException)
            {
                FileCopierReadFileException e2 = (FileCopierReadFileException)message;
                SetupLogger.LogError(e2);
                text = Strings.NoFilesToCopy(this.sourceDir).ToString();
            }
            else if (message is Exception)
            {
                SetupLogger.LogError((Exception)message);
                text = Strings.FileCopyingError.ToString();
            }
            MessageBoxHelper.ShowError(text);
        }
Exemple #13
0
 private void LogAssemblyVersion()
 {
     SetupLoggerImpl.BuildVersion = ConfigurationContext.Setup.GetExecutingVersion().ToString();
     SetupLogger.Log(Strings.AssemblyVersion(SetupLoggerImpl.BuildVersion));
 }
Exemple #14
0
 // Token: 0x06000008 RID: 8 RVA: 0x000021B5 File Offset: 0x000003B5
 public override void ReportMessage(string message)
 {
     SetupLogger.Log(new LocalizedString(message));
     Console.WriteLine(base.InteractionHandler.WrapText(message));
 }
Exemple #15
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);
        }
Exemple #16
0
 // Token: 0x0600014E RID: 334 RVA: 0x00007954 File Offset: 0x00005B54
 public void StopFileCopying()
 {
     SetupLogger.Log(Strings.CancelFileCopying);
     this.cancelFileCopy = true;
 }