Beispiel #1
0
        public static bool FindAgreementFile(ref String path, CMP.Setup.AgreementType agreementType)
        {
            bool returnValue = true;

            agreementType = AgreementType.Notice;
            String setupExePath = PropertyBagDictionary.Instance.GetProperty <string>(PropertyBagDictionary.SetupExePath);

            path        = Path.Combine(setupExePath, "Notice.rtf");
            returnValue = SetupFileValidation.ValidateFileExists(path);

            return(returnValue);
        }
Beispiel #2
0
        /// <summary>
        /// Checks to see if we have all needed install item files.
        /// </summary>
        /// <returns>true if they are all there, if not false (and asks for new path if not silent)</returns>
        public static bool HaveAllNeededInstallItemFiles()
        {
            if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Uninstall))
            {
                // we are doing an uninstall so we don't need anything from the CD
                return(true);
            }
            else
            {
                bool haveAllNeededFiles = true;

                foreach (InstallItemsInstallDataItem itemToInstall in PropertyBagDictionary.Instance.GetProperty <ArrayList>(PropertyBagConstants.ItemsToInstall))
                {
                    if (!string.IsNullOrEmpty(itemToInstall.FullPathToLaunch))
                    {
                        haveAllNeededFiles = haveAllNeededFiles & SetupFileValidation.ValidateFileExists(itemToInstall.FullPathToLaunch);
                    }
                }

                if (haveAllNeededFiles)
                {
                    return(true);
                }

                // When we get here in the logic, we must return false...
                if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagDictionary.Silent))
                {
                    // We don't have all the files and we are silent.... we must fail.
                    SetupLogger.LogError(
                        "HaveAllNeededInstallItemFiles:  We are missing some of the install files needed by the installitems.  Please check the path {0} to make sure it pointing to the root of our files.",
                        PropertyBagDictionary.Instance.GetProperty <string>(PropertyBagConstants.LocationOfSetupFiles));
                }
                else
                {
                    // Open a browser on at my MyComputer and save the browsed location to the propertybag
                    string diskLocation = string.Empty;
                    SetupHelpers.BrowseFromLocation(
                        Environment.GetFolderPath(Environment.SpecialFolder.MyComputer),
                        WpfResources.WPFResourceDictionary.PromptForSetupFiles,
                        out diskLocation);

                    if (string.IsNullOrEmpty(diskLocation) == false)
                    {
                        diskLocation = Path.Combine(diskLocation, SetupConstants.SetupFolder);
                        if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.ArchitectureIs64Check))
                        {
                            diskLocation = Path.Combine(diskLocation, "amd64");
                        }
                        else
                        {
                            diskLocation = Path.Combine(diskLocation, "i386");
                        }

                        if (Directory.Exists(diskLocation))
                        {
                            ResetInstallItemFileLocations(
                                PropertyBagDictionary.Instance.GetProperty <string>(PropertyBagConstants.LocationOfSetupFiles),
                                diskLocation);
                            PropertyBagDictionary.Instance.SafeAdd(PropertyBagConstants.LocationOfSetupFiles, diskLocation);
                        }
                        else
                        {
                            SetupLogger.LogInfo("Path {0} does not exist.", diskLocation);
                        }
                    }
                }
            }

            // We did not have all the files we needed.
            return(false);
        }