Пример #1
0
        /// <summary>
        /// Launch Setup in Silent Mode
        /// </summary>
        /// <returns>a SetupReturnValues reflecting success or possible failure causes</returns>
        private static SetupReturnValues SilentRun()
        {
            // Setup the data for the items to install
            PrepareInstallData.PrepareInstallDataItems();

            // Check to see that we have all the install files we need.
            // Make sure the file locations are set for the install files.
            SetupFileValidation.ResetInstallItemFileLocations(
                PropertyBagDictionary.Instance.GetProperty <string>(PropertyBagConstants.LocationOfSetupFiles),
                PropertyBagDictionary.Instance.GetProperty <string>(PropertyBagConstants.LocationOfSetupFiles));

            if (!PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Uninstall))
            {
                if (!SetupFileValidation.HaveAllNeededInstallItemFiles())
                {
                    return(SetupReturnValues.InvalidInstallImage);
                }

                SetupHelpers.SetFeatureSwitches();
                // If we are not uninstalling, Do the prereq check
                if (2 == SetupHelpers.DoAllPrerequisiteChecks())
                {
                    // We failed prereq tests so we will fail the install
                    SetupLogger.LogError("We failed the prerequisite checks.");
                    return(SetupReturnValues.FailedPrerequisiteChecks);
                }

                // If this is a server installation,
                // - check if there is an existing database,
                // and if so, check if upgrade is supported from that version
                // - make sure client is also installed with server.
                if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Server))
                {
                    // Error conditions
                    // An unsupported database found
                    // A supported database is found, but user didnt explicitly specify upgrade

                    // CheckDatabase will throw an exception if DB version is
                    // incompatible
                    string sqlMachineName = (String)SetupInputs.Instance.FindItem(SetupInputTags.SqlMachineNameTag);

                    String fullInstanceName = SetupDatabaseHelper.ConstructFullInstanceName(
                        !SetupDatabaseHelper.SqlServerIsOnLocalComputer(sqlMachineName),
                        sqlMachineName,
                        (String)SetupInputs.Instance.FindItem(SetupInputTags.SqlInstanceNameTag),
                        (int)SetupInputs.Instance.FindItem(SetupInputTags.SqlServerPortTag));
                }
            }

            // Do the install using the passed information
            InstallActionProcessor installs = new InstallActionProcessor();

            SetupLogger.LogInfo("Silent ProcessInstalls Starting");

            SetupReturnValues rturn = installs.ProcessInstalls();

            SetupLogger.LogInfo("Silent ProcessInstalls Done");

            return(rturn);
        }
Пример #2
0
        /// <summary>
        /// Iterates through the given path and returns the existing valid parent folder
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static String GetExistingAncestor(String path)
        {
            AppAssert.AssertNotNull(path, "path");

            // Check if the path exists
            if (Directory.Exists(path))
            {
                SetupLogger.LogInfo("InstallLocationPage.SetPathInBrowserDialog : The path {0} exists, returning", path);
                return(path);
            }

            String ancestor = null;
            int    index    = path.LastIndexOf(Path.DirectorySeparatorChar);

            while (index >= 0)
            {
                ancestor = path.Substring(0, index);
                SetupLogger.LogInfo("InstallLocationPage.SetPathInBrowserDialog : Check if the ancestor {0} exists", ancestor);
                if (Directory.Exists(ancestor))
                {
                    SetupLogger.LogInfo("InstallLocationPage.SetPathInBrowserDialog : The ancestor {0} exists, returning", ancestor);
                    return(ancestor + Path.DirectorySeparatorChar);
                }

                index = ancestor.LastIndexOf(Path.DirectorySeparatorChar);
            }
            return(null);
        }
Пример #3
0
        /// <summary>
        /// Loads and initializes all UI pages.
        /// </summary>
        /// <returns>the newly created IPageHost interface object</returns>
        private static IPageHost LoadUiPages()
        {
            // Creates a page factory, a host page and set up page navigation
            Factory   factory = new WpfFactory();
            IPageHost host    = factory.CreateHost();

            PageNavigation.Instance.Host = host;

            // Add wait screen here if needed.
            XmlSerializer serializer = new XmlSerializer(typeof(Pages));

            using (MemoryStream stream = new MemoryStream())
            {
                using (StreamWriter writer = new StreamWriter(stream))
                {
                    writer.Write(Properties.Resources.Pages);
                    writer.Flush();
                    stream.Position = 0;
                    Pages inputPages = (Pages)serializer.Deserialize(stream);

                    foreach (PagesPage page in inputPages.Page)
                    {
                        SetupLogger.LogInfo("Adding Page {0}", page.Id);
                        Page workingPage = new Page(factory, host, page);

                        // Add this page to our pages
                        PageRegistry.Instance.RegisterPage(workingPage);
                    }
                }
            }

            PropertyBagDictionary.Instance.SafeAdd(PropertyBagConstants.ScreensLoaded, "1");
            return(host);
        }
Пример #4
0
        public bool TokenMembershipCheck(string sid)
        {
            bool   result = false;
            IntPtr zero   = IntPtr.Zero;

            try
            {
                if (!NativeMethodProvider.ConvertStringSidToSid(sid, out zero))
                {
                    throw new Win32Exception(Marshal.GetLastWin32Error());
                }
                if (!NativeMethodProvider.CheckTokenMembership(IntPtr.Zero, zero, ref result))
                {
                    throw new Win32Exception(Marshal.GetLastWin32Error());
                }
            }
            catch (Exception e)
            {
                SetupLogger.LogError(e);
            }
            finally
            {
                if (zero != IntPtr.Zero)
                {
                    NativeMethodProvider.LocalFree(zero);
                }
            }
            return(result);
        }
Пример #5
0
        /// <summary>
        /// Prepares the install data items.
        /// </summary>
        public static void PrepareInstallDataItems()
        {
            ArrayList itemsToInstall = new ArrayList();

            foreach (KeyValuePair <string, InstallItemsInstallDataItem> valuePair in InstallDataItemRegistry.Instance.InstallDataItems)
            {
                //If there is a property in the property bag that matches the name of this InstallDataItem
                //then we should add it to the list to install.
                if (PropertyBagDictionary.Instance.PropertyExists(valuePair.Key))
                {
                    itemsToInstall.Add(valuePair.Value);
                }
                else
                {
                    SetupLogger.LogInfo("No match for {0} found.", valuePair.Key);
                }
            }

            // if this is an uninstall, we should reverse the order of everything except the postinstall guy... that must stay in the same place.
            if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Uninstall))
            {
                itemsToInstall.Reverse(0, itemsToInstall.Count - 1);
            }

            PropertyBagDictionary.Instance.SafeAdd(PropertyBagConstants.ItemsToInstall, itemsToInstall);

            SetupLogger.LogInfo("PrepareInstallDataItems: Install Item list:");
            SetupLogger.LogInfo("***************************");
            foreach (InstallItemsInstallDataItem dataItem in itemsToInstall)
            {
                SetupLogger.LogInfo(dataItem.DisplayTitle);
            }
            SetupLogger.LogInfo("***************************");
        }
Пример #6
0
        private void textBoxUserName_LostFocus(object sender, EventArgs e)
        {
            try
            {
                String fullUserName = this.textBoxUserName.Text;

                string[] nameSplits = fullUserName.Split(SetupConstants.AccountDomainUserSeparator);
                if (nameSplits.Length == 1)
                {
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminDomainTag, String.Empty);
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminNameTag, nameSplits[0]);
                }
                else if (nameSplits.Length == 2)
                {
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminDomainTag, nameSplits[0]);
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminNameTag, nameSplits[1]);
                }
                else
                {
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminDomainTag, String.Empty);
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminNameTag, String.Empty);
                }
            }
            catch (Exception backEndErrorException)
            {
                SetupLogger.LogException(backEndErrorException);
                SetupHelpers.ShowError(backEndErrorException.Message);
            }

            this.SetNextButtonState();
        }
Пример #7
0
        /// <summary>
        /// Moves backward from RemoveWAPDatabasePage page.
        /// It can go to:
        /// 0 - AddRemoveComponentsPage
        /// 1 - RemoveDatabasePage, if we are on the uninstall path and we are uninstalling server
        /// </summary>
        /// <param name="currentPage">The current page.</param>
        /// <returns>Page to move to</returns>
        public static Page BackwardFromRemoveWAPDatabasePageHandler(Page currentPage)
        {
            string nextPageChoices = currentPage.PreviousPageArgument;

            string[] pageChoices = nextPageChoices.Split(new char[] { ',' });

            // Check to see if the length is correct
            if (pageChoices.Length != 2)
            {
                SetupLogger.LogError("ForwardFromAddRemoveComponentsPageHandler: Invalid XML description for Page");
                SetupLogger.LogError("XML Was {0}:", nextPageChoices);
                SetupLogger.LogError("XML should have been like: FirstPage,SecondPage");
                throw new ArgumentException(currentPage.ToString());
            }
            String AddRemoveComponentsPage = pageChoices[0];
            String RemoveDatabasePage      = pageChoices[1];

            // default to go to the ReadyToInstallPage
            Page pageToReturn = PageRegistry.Instance.GetPage(AddRemoveComponentsPage);

            // Check if we are on the uninstall path
            if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Uninstall) &&
                PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Server))
            {
                SetupLogger.LogInfo("ForwardFromAddRemoveComponentsPageHandler: Move to Remove WAP Database Page");
                pageToReturn = PageRegistry.Instance.GetPage(RemoveDatabasePage);
            }

            return(pageToReturn);
        }
Пример #8
0
        /// <summary>
        /// Validates the inputs on this page
        /// </summary>
        /// <returns></returns>
        public override bool ValidatePage()
        {
            bool isPageValid = true;

            try
            {
                if (this.checkBoxNewUserId.IsChecked.GetValueOrDefault(false))
                {
                    String userName   = SetupInputs.Instance.FindItem(SetupInputTags.WapSqlDBAdminNameTag);
                    String domainName = SetupInputs.Instance.FindItem(SetupInputTags.WapSqlDBAdminDomainTag);
                    if (!UserAccountHelper.ValidateCredentials(userName, domainName, this.passwordBoxPassword.SecurePassword))
                    {
                        throw new Exception("Either the domain account or the password you entered are not valid.");
                    }
                }
            }
            catch (Exception backEndErrorException)
            {
                SetupLogger.LogException(backEndErrorException);
                SetupHelpers.ShowError(backEndErrorException.Message);

                isPageValid = false;
            }
            return(isPageValid);
        }
        public string GetUserNameEx(ValidationConstant.ExtendedNameFormat extendedNameType)
        {
            StringBuilder stringBuilder = new StringBuilder(256);

            try
            {
                int capacity = stringBuilder.Capacity;
                if (ManagedMethodProvider.GetUserNameEx(extendedNameType, stringBuilder, ref capacity) == 0)
                {
                    int num = Marshal.GetLastWin32Error();
                    if (num == 234)
                    {
                        stringBuilder.Capacity = capacity;
                        num = 0;
                        if (ManagedMethodProvider.GetUserNameEx(extendedNameType, stringBuilder, ref capacity) == 0)
                        {
                            num = Marshal.GetLastWin32Error();
                        }
                    }
                    if (num != 0)
                    {
                        throw new Win32Exception(num);
                    }
                }
            }
            catch (Exception e)
            {
                SetupLogger.LogError(e);
                throw;
            }
            return(stringBuilder.ToString());
        }
Пример #10
0
        /// <summary>
        /// Forwards to page based on property value handler.
        /// Ok so this fuction takes a string that looks like this
        /// [nameofproperty],[screenfor0],[screeenfor1],[screenfor2],...,[screenforN]
        /// it parses and looks for the property in the property bag.
        /// if it finds it, it returns the screen from the input that matches the value
        /// of the property bag entry.
        /// </summary>
        /// <param name="currentPage">The current page.</param>
        /// <returns>Page to move to</returns>
        public static Page ForwardToPageBasedOnPropertyValueHandler(Page currentPage)
        {
            string nextPageChoices = currentPage.NextPageArgument;
            int    pageToMoveTo    = 0;

            string[] pageChoices = nextPageChoices.Split(new char[] { ',' });

            // Check to see if the length is correct
            if (pageChoices.Length < 2)
            {
                SetupLogger.LogError("ForwardToPageBasedOnPropertyValueHandler: Invalid XML description for Page");
                throw new ArgumentException(currentPage.ToString());
            }

            if (!PropertyBagDictionary.Instance.PropertyExists(pageChoices[0]))
            {
                // Page not specified
                SetupLogger.LogError("ForwardToPageBasedOnPropertyValueHandler: Missing property bag entry for {0}.  This entry is vital to select the next page.", pageChoices[0]);
                throw new ArgumentException(currentPage.ToString());
            }
            else
            {
                pageToMoveTo = 1 + PropertyBagDictionary.Instance.GetProperty <int>(pageChoices[0]);
                SetupLogger.LogInfo("ForwardToPageBasedOnPropertyValueHandler: Property bag entry for {0} is {1}.  This means that we will move to a next page id {2}.", pageChoices[0], pageToMoveTo.ToString(), pageChoices[pageToMoveTo]);
            }

            // We will go to the page specifed in the pageChoice
            return(PageRegistry.Instance.GetPage(pageChoices[pageToMoveTo]));
        }
Пример #11
0
        public static bool SimplePreinstallProcessor(String controlTitle, bool wipeCmdArg)
        {
            bool returnValue = true;

            try
            {
                // Find the current installdata item in the array
                InstallItemsInstallDataItem simpleInstallItem = null;
                foreach (InstallItemsInstallDataItem itemToInstall in PropertyBagDictionary.Instance.GetProperty <ArrayList>(PropertyBagConstants.ItemsToInstall))
                {
                    if (string.Equals(itemToInstall.ControlTitle, controlTitle, StringComparison.OrdinalIgnoreCase))
                    {
                        simpleInstallItem = itemToInstall;
                        break;
                    }
                }

                if (simpleInstallItem == null)
                {
                    // Item not found - throw an exception
                    SetupLogger.LogError(String.Format("SimplePreinstallProcessor:{0} Install Data item not found.", controlTitle));
                    throw new ArgumentException(String.Format("{0} Item To Install not found", controlTitle));
                }
                else
                {
                    PropertyBagDictionary.Instance.SafeAdd("CurrentWorkingInstallItem", simpleInstallItem);
                }

                // Set the Install/Uninstall state
                if (!PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Uninstall))
                {
                    simpleInstallItem.ItemWeAreInstallingEnumValue =
                        simpleInstallItem.ItemWeAreInstallingEnumValue | InstallItemsInstallDataItem.InstallDataInputs.Installing;
                }
                else
                {
                    simpleInstallItem.ItemWeAreInstallingEnumValue =
                        simpleInstallItem.ItemWeAreInstallingEnumValue | InstallItemsInstallDataItem.InstallDataInputs.Uninstalling;
                }

                // Set the location of the log file
                simpleInstallItem.LogFile = SetupHelpers.SetLogFilePath(simpleInstallItem.LogFile);

                // If this is an uninstall then wipe the current commandline arguments.
                if (wipeCmdArg && PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Uninstall))
                {
                    simpleInstallItem.Arguments = "REMOVE=ALL";
                }
            }
            catch (ArgumentException exception)
            {
                if (!PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.FailureReason))
                {
                    PropertyBagDictionary.Instance.SafeAdd(PropertyBagConstants.FailureReason, exception);
                }
                returnValue = false;
            }

            return(returnValue);
        }
Пример #12
0
        /// <summary>
        /// Validates the file exists.
        /// </summary>
        /// <param name="fileToLookFor">The file to look for.</param>
        /// <returns>true if the file is found, false otherwise.</returns>
        public static bool ValidateFileExists(string fileToLookFor)
        {
            bool returnValue = false;

            SetupLogger.LogInfo("Looking for file: {0}.", fileToLookFor);
            if (!File.Exists(fileToLookFor))
            {
                if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.MissingFilesList))
                {
                    // We are making a list to show the user.
                    StringBuilder missingFiles = PropertyBagDictionary.Instance.GetProperty <StringBuilder>(PropertyBagConstants.MissingFilesList);
                    missingFiles.AppendLine(fileToLookFor); // Name of the missing file
                    missingFiles.AppendLine(string.Empty);  // Extra space to make the dialog more readable
                    PropertyBagDictionary.Instance.SafeAdd(PropertyBagConstants.MissingFilesList, missingFiles);
                }

                returnValue = false;
                SetupLogger.LogInfo("Missing {0}.", fileToLookFor);
            }
            else
            {
                SetupLogger.LogInfo("Found {0}.", fileToLookFor);
                returnValue = true;
            }

            return(returnValue);
        }
Пример #13
0
        /// <summary>
        /// Validates EULA file exists on the media.
        /// </summary>
        /// <returns>true if successful</returns>
        public static bool ExistEULAFile()
        {
            bool returnValue = true;

            // Print a pretty header for the log...
            SetupLogger.LogInfo(string.Empty);
            SetupLogger.LogInfo("**************************************************");

            // Make the entry in the property bad if it is not there
            if (!PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.MissingFilesList))
            {
                StringBuilder missingFiles = new StringBuilder();
                PropertyBagDictionary.Instance.SafeAdd(PropertyBagConstants.MissingFilesList, missingFiles);
            }

            // Print a pretty footer for the log.
            SetupLogger.LogInfo("**************************************************");

            if (!returnValue)
            {
                StringBuilder missingFiles = PropertyBagDictionary.Instance.GetProperty <StringBuilder>(PropertyBagConstants.MissingFilesList);
                SetupLogger.LogInfo(string.Format(CultureInfo.CurrentCulture, WpfResources.WPFResourceDictionary.MissingFileFormatString, missingFiles.ToString()));
                SetupHelpers.ShowError(string.Format(CultureInfo.CurrentCulture, WpfResources.WPFResourceDictionary.MissingFileFormatString, missingFiles.ToString()));
            }
            else
            {
                SetupLogger.LogInfo("All vital setup files found.");
            }

            // Cleanup the property bag
            PropertyBagDictionary.Instance.Remove(PropertyBagConstants.MissingFilesList);
            return(returnValue);
        }
Пример #14
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);
     }
 }
Пример #15
0
        /// <summary>
        /// Resets the install item file locations.
        /// </summary>
        /// <param name="oldLocation">The old location.</param>
        /// <param name="newLocation">The new location.</param>
        public static void ResetInstallItemFileLocations(string oldLocation, string newLocation)
        {
            SetupLogger.LogInfo("*****ResetInstallItemFileLocations********************************************");
            foreach (InstallItemsInstallDataItem itemToInstall in PropertyBagDictionary.Instance.GetProperty <ArrayList>(PropertyBagConstants.ItemsToInstall))
            {
                if (!string.IsNullOrEmpty(itemToInstall.FullPathToLaunch))
                {
                    // if the old path is set, replace... otherwise, add
                    if (itemToInstall.FullPathToLaunch.Contains(oldLocation))
                    {
                        if (oldLocation.EndsWith(Path.DirectorySeparatorChar.ToString()) &&
                            !newLocation.EndsWith(Path.DirectorySeparatorChar.ToString()))
                        {
                            // We need to add a \ to the new location
                            newLocation = newLocation + Path.DirectorySeparatorChar;
                        }

                        itemToInstall.FullPathToLaunch = itemToInstall.FullPathToLaunch.Replace(oldLocation, newLocation);
                    }
                    else
                    {
                        // get rid of the parent ".." symble in path
                        String path = newLocation;
                        if (newLocation.EndsWith(Path.DirectorySeparatorChar.ToString()))
                        {
                            path = newLocation.Substring(0, newLocation.LastIndexOf(Path.DirectorySeparatorChar));
                        }
                        while (itemToInstall.FullPathToLaunch.IndexOf("..") == 0)
                        {
                            itemToInstall.FullPathToLaunch = itemToInstall.FullPathToLaunch.Substring(3);
                            path = path.Substring(0, path.LastIndexOf(Path.DirectorySeparatorChar));
                        }

                        itemToInstall.FullPathToLaunch = Path.Combine(path, itemToInstall.FullPathToLaunch);
                    }

                    // get locale
                    if (itemToInstall.FullPathToLaunch.Contains(SetupConstants.UnknownLCID))
                    {
                        String fileFullPath = itemToInstall.FullPathToLaunch.Replace(SetupConstants.UnknownLCID, CultureInfo.CurrentUICulture.LCID.ToString());
                        if (File.Exists(fileFullPath))
                        {
                            itemToInstall.FullPathToLaunch = fileFullPath;
                        }
                        else
                        {
                            // the locale file does not exist, use the English one as default
                            itemToInstall.FullPathToLaunch = itemToInstall.FullPathToLaunch.Replace(SetupConstants.UnknownLCID, SetupConstants.BaseLanguageID);
                        }
                    }

                    SetupLogger.LogInfo("Item:        {0}", itemToInstall.DisplayTitle);
                    SetupLogger.LogInfo("path set to: {0}", itemToInstall.FullPathToLaunch);
                    SetupLogger.LogInfo("------------------------------------------------------------------------------");
                }
            }

            SetupLogger.LogInfo("******************************************************************************");
        }
Пример #16
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);
     }
 }
Пример #17
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);
        }
Пример #18
0
        /// <summary>
        /// Moves back from ReadyToInstall page.
        /// </summary>
        /// <param name="currentPage">The current page.</param>
        /// <returns>Page to move to</returns>
        public static Page BackwardFromReadyToInstallPage(Page currentPage)
        {
            string previousPageChoices = currentPage.PreviousPageArgument;

            string[] pageChoices = previousPageChoices.Split(new char[] { ',' });

            String AccountConfigurationPage   = pageChoices[0];
            String ARPAddRemoveComponentsPage = pageChoices[1];
            String ARPRemoveDatabasePage      = pageChoices[2];
            String ARPRemoveWAPDatabasePage   = pageChoices[3];
            String EulaPage = pageChoices[4];

            // Set default next page to PortConfigurationPage
            Page pageToReturn = PageRegistry.Instance.GetPage(AccountConfigurationPage);

            if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Uninstall))
            {
                // If we are at the uninstall path
                // then we need to check whether we are uninstalling a standalone server
                // or the last node of HA VMM server
                // if that's the case, then we need to move back to Retain DB option page
                if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Server))
                {
                    SetupLogger.LogInfo("BackwardFromReadyToInstallPage: Move to Remove Database Page");
                    pageToReturn = PageRegistry.Instance.GetPage(ARPRemoveDatabasePage);
                }
                else
                {
                    SetupLogger.LogInfo("BackwardFromReadyToInstallPage: Move to Add/Remove Components Page");
                    pageToReturn = PageRegistry.Instance.GetPage(ARPAddRemoveComponentsPage);
                }

                // Override the server database options when the extension is getting removed
                if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.ExtensionCommon))
                {
                    SetupLogger.LogInfo("BackwardFromReadyToInstallPage: Move to Remove WAP Database Page");
                    pageToReturn = PageRegistry.Instance.GetPage(ARPRemoveWAPDatabasePage);
                }
            }
            else
            {
                if (!PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Server))
                {
                    if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.ExtensionCommon))
                    {
                        pageToReturn = PageRegistry.Instance.GetPage(AccountConfigurationPage);
                    }
                    else
                    {
                        // No customization if the installation doesn't involve the WAP common components
                        pageToReturn = PageRegistry.Instance.GetPage(EulaPage);
                    }
                }
            }

            return(pageToReturn);
        }
Пример #19
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));
     }
 }
Пример #21
0
        public static bool AdminWAPExtensionPostIstallProcessor()
        {
            SetupLogger.LogInfo("WAPExtensionPostIstallProcessor: Entered.");
            bool returnValue = true;

            // TODO: Run post-installation required tasks

            return(returnValue);
        }
 // 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));
     }
 }
Пример #23
0
 // 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);
     }
 }
Пример #24
0
        public static bool AdminWAPExtensionPreinstallProcessor()
        {
            bool returnValue = true; // used to store the return value for this function

            try
            {
                InstallItemsInstallDataItem adminWapExtensionInstallItem = null;

                // Find the Client installdata item in the array
                foreach (InstallItemsInstallDataItem itemToInstall in PropertyBagDictionary.Instance.GetProperty <ArrayList>(PropertyBagConstants.ItemsToInstall))
                {
                    if (string.Equals(itemToInstall.ControlTitle, PropertyBagConstants.AdminWAPExtension, StringComparison.OrdinalIgnoreCase))
                    {
                        adminWapExtensionInstallItem = itemToInstall;
                        break;
                    }
                }

                if (adminWapExtensionInstallItem == null)
                {
                    // Item not found - throw an exception
                    SetupLogger.LogError("PageCustomDelegates: AdminWAPExtensionPreinstallProcessor: Install Data item not found.");
                    throw new ArgumentException(WpfResources.WPFResourceDictionary.InvalidArgument);
                }

                // Set the Install/Uninstall state
                adminWapExtensionInstallItem.ItemWeAreInstallingEnumValue = adminWapExtensionInstallItem.ItemWeAreInstallingEnumValue |
                                                                            (PropertyBagDictionary.Instance.PropertyExists("uninstall") ? InstallItemsInstallDataItem.InstallDataInputs.Uninstalling : InstallItemsInstallDataItem.InstallDataInputs.Installing);

                // If this is not an uninstall, remove the product code.
                if (0 == (adminWapExtensionInstallItem.ItemWeAreInstallingEnumValue & InstallItemsInstallDataItem.InstallDataInputs.Uninstalling))
                {
                    adminWapExtensionInstallItem.ProductCode = string.Empty;
                }

                // Set the location of the log file
                adminWapExtensionInstallItem.LogFile = SetupHelpers.SetLogFilePath(adminWapExtensionInstallItem.LogFile);

                SetupHelpers.CreateEventSources();

                // Adjust the command line arguments
                adminWapExtensionInstallItem.Arguments += ConfigureBasicCommandLineArguments() + ConfigureAdminWAPCommandlineArguments();
            }
            catch (ArgumentException exception)
            {
                if (!PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.FailureReason))
                {
                    PropertyBagDictionary.Instance.SafeAdd(PropertyBagConstants.FailureReason, exception);
                }
                returnValue = false;
            }

            // Do any other tasks that are needed.
            return(returnValue);
        }
Пример #25
0
        // 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();
        }
Пример #26
0
        /// <summary>
        /// Forward from switch page to start page handler.
        /// 0 - ARPStartPageSwitch (Add/Remove)
        /// 1 - InitialInstallStartPageSwitch (Initial install)
        /// 2 - ConfigInitialInstallStartPageSwitch (VHD Configuration - Setup/Config scenario)
        /// 3 - UpgradeStartPageSwitch (Upgrade)
        /// </summary>
        /// <param name="currentPage">The current page.</param>
        /// <returns>Page to move to</returns>
        public static Page ForwardFromSwitchPageHandler(Page currentPage)
        {
            string nextPageChoices = currentPage.NextPageArgument;

            string[] pageChoices = nextPageChoices.Split(new char[] { ',' });

            // default to the upgrade page.
            Page pageToReturn = PageRegistry.Instance.GetPage(pageChoices[0]);

            SetupLogger.LogInfo("ForwardFromSwitchPageHandler: Moving to page {0}", pageToReturn.Id);
            return(pageToReturn);
        }
Пример #27
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));
     }
 }
Пример #28
0
        /// <summary>
        /// Logs all inputs to the log file
        /// </summary>
        public void LogInputs()
        {
            InputParameter inputParameter = null;

            foreach (String parameter in parameterList)
            {
                inputParameter = this.FindItem(parameter);
                if (inputParameter.Valid && inputParameter.CanLogToFile)
                {
                    SetupLogger.LogInfo(parameter);
                    SetupLogger.LogInfo(inputParameter.InputValue.ToString());
                }
            }
        }
Пример #29
0
        private void passwordBox_PasswordChanged(object sender, EventArgs e)
        {
            try
            {
                SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminPasswordTag, this.passwordBoxPassword.SecurePassword);
            }
            catch (Exception backEndErrorException)
            {
                SetupLogger.LogException(backEndErrorException);
                SetupHelpers.ShowError(backEndErrorException.Message);
            }

            this.SetNextButtonState();
        }
        private void PopulateDatabaseNameItemsWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.comboBoxExistingDatabaseName.Text = String.Empty;
            this.comboBoxExistingDatabaseName.Items.Clear();

            // First, handle the case where an exception was thrown.
            if (e.Error != null)
            {
                SetupLogger.LogError("Database population failed");
                SetupHelpers.ShowError(e.Error.Message);
            }
            else if (e.Cancelled)
            {
                SetupLogger.LogInfo("Database population has been cancelled.");
            }
            else
            {
                // Handle the case where the operation succeeded.
                String[] databaseNames = e.Result as String[];
                if (databaseNames != null && databaseNames.Length > 0)
                {
                    foreach (String databaseName in databaseNames)
                    {
                        this.comboBoxExistingDatabaseName.Items.Add(databaseName);
                    }

                    // First satisfy the below scenario:
                    // - User clicked on existing db radio button and selected a db
                    // - then clicked new db radio button
                    // - and then clicked existing radio db again w/o changin server, instance, or port info
                    // Basically, check if the selected instance already exists in the list
                    // if yes, then choose it
                    // otherwise, this is a new population, select the first item
                    if (this.comboBoxExistingDatabaseName.Items.Contains(selectedDatabase))
                    {
                        this.comboBoxExistingDatabaseName.Text = selectedDatabase;
                        this.radioExistingDatabase.IsChecked   = true;
                    }
                    else
                    {
                        this.selectedDatabase = databaseNames[0];
                        this.comboBoxExistingDatabaseName.Text = this.selectedDatabase;
                        this.radioNewDatabase.IsChecked        = true;
                    }
                }
            }

            this.EnableInputMode();
        }