示例#1
0
        internal static void RemoveAnyFilesAndFoldersCreatedByTests(RestoreProjectSettings settings)
        {
            RemoveAllFilesFromFolderAndSubfolders(FdoFileHelper.GetBackupSettingsDir(settings.ProjectPath));
            RemoveAllFilesFromFolderAndSubfolders(settings.ProjectSupportingFilesPath);
            RemoveAllFilesFromFolderAndSubfolders(settings.FlexConfigurationSettingsPath);
            RemoveAllFilesFromFolderAndSubfolders(settings.PicturesPath);
            RemoveAllFilesFromFolderAndSubfolders(settings.MediaPath);
            RemoveAllFilesFromFolderAndSubfolders(settings.OtherExternalFilesPath);
            RemoveAllFilesFromFolderAndSubfolders(settings.LinkedFilesPath);
            RemoveAllFilesFromFolderAndSubfolders(settings.WritingSystemStorePath);
            RemoveAllFilesFromFolderAndSubfolders(Path.Combine(settings.ProjectPath, FdoFileHelper.ksSortSequenceTempDir));

            //Remove this one last of all because the other folders need to be removed first.
            RemoveAllFilesFromFolderAndSubfolders(settings.ProjectPath);
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Persists the dialog settings as an XML file.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void PersistBackupFileSettings()
        {
            string backupSettingsFile = Path.Combine(FdoFileHelper.GetBackupSettingsDir(
                                                         m_settings.ProjectPath), FdoFileHelper.kBackupSettingsFilename);

            string settingsDir = Path.GetDirectoryName(backupSettingsFile);

            if (!Directory.Exists(settingsDir))
            {
                Directory.CreateDirectory(settingsDir);
            }

            using (FileStream fs = new FileStream(backupSettingsFile, FileMode.Create))
            {
                BackupFileSettings.SaveToStream(m_settings, fs);
            }
        }