/// <summary> /// Removes offline data for the server /// </summary> /// <param name="serverName">Name of server for which the data is to be removed</param> public void RemoveServerData(string serverName) { const string databaseName = "offlineDB.sql"; var databaseFilenames = this.GetOfflineStoragePaths(databaseName); foreach (var databaseFilename in databaseFilenames) { if (PlatformService.StorageProvider.FileExists(databaseFilename)) { using (var database = OfflineDatabase.Create(databaseFilename)) { DeleteAllTables(database); database.Reset(); } } } var rootFolder = PlatformService.StorageProvider.DocumentsFolderPath; var directoriesToBeRemoved = PlatformService.StorageProvider .GetSubDirectoryNames(rootFolder) .Where(name => name.Contains("@" + serverName)) .Select(name => Path.Combine(rootFolder, name)); foreach (var directoryPath in directoriesToBeRemoved) { Exception error; if (!PlatformService.StorageProvider.TryDelete(directoryPath, out error)) { this.Logger.LogError($"Could not remove offline data when server {serverName}, was removed: {error}"); } } }