/// <summary> /// Determine if a dictionary database file exists in the specified directory. /// </summary> /// <param name="directory">The directory to look in.</param> /// <returns>True if the database file exists, false otherwise.</returns> public static bool Exists(string directory) { if (null == directory) { throw new ArgumentNullException("directory"); } if (Directory.Exists(directory)) { var defaultConfig = PersistentDictionaryDefaultConfig.GetDefaultDatabaseConfig(); var config = new DatabaseConfig() { DatabaseFilename = Path.Combine(directory, defaultConfig.DatabaseFilename) }; config.Merge(defaultConfig, MergeRules.KeepExisting); return(PersistentDictionaryFile.Exists(config)); } return(false); }
// File/Directory not availble in Windows Store Apps. #else /// <summary> /// Delete all files associated with a PersistedDictionary database from /// the specified directory. /// </summary> /// <param name="directory">The directory to delete the files from.</param> public static void DeleteFiles(string directory) { if (null == directory) { throw new ArgumentNullException("directory"); } if (Directory.Exists(directory)) { var defaultConfig = PersistentDictionaryDefaultConfig.GetDefaultDatabaseConfig(); var config = new DatabaseConfig() { DatabaseFilename = Path.Combine(directory, defaultConfig.DatabaseFilename), SystemPath = directory, LogFilePath = directory, TempPath = directory, }; config.Merge(defaultConfig, MergeRules.KeepExisting); PersistentDictionaryFile.DeleteFiles(config); } }