public override bool PrepareRestore() { bool result = false; using (RestoreForm dlg = new RestoreForm(this)) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { _selectedBackupItem = dlg.SelectedBackupItem; _restorePath = dlg.RestoreFolder; string directoryName = _restorePath; if (!Directory.Exists(_restorePath)) { Directory.CreateDirectory(_restorePath); } if (_fileCollection != null) { _fileCollection.Dispose(); _fileCollection = null; } PluginSettings.Instance.ActiveDataFile = Path.Combine(_restorePath, Path.GetFileName(_selectedBackupItem.OriginalPath)); SetDataSourceName(PluginSettings.Instance.ActiveDataFile); Core.Geocaches.Clear(); Core.Logs.Clear(); Core.Waypoints.Clear(); Core.LogImages.Clear(); Core.UserWaypoints.Clear(); result = true; } } return(result); }
public override bool PrepareRestore() { bool result = false; using (RestoreForm dlg = new RestoreForm(this)) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { _selectedBackupItem = dlg.SelectedBackupItem; _restorePath = dlg.RestoreFolder; string directoryName = _restorePath; if (!Directory.Exists(_restorePath)) Directory.CreateDirectory(_restorePath); if (_fileCollection != null) { _fileCollection.Dispose(); _fileCollection = null; } Properties.Settings.Default.ActiveDataFile = Path.Combine(_restorePath, Path.GetFileName(_selectedBackupItem.OriginalPath)); Properties.Settings.Default.Save(); SetDataSourceName(Properties.Settings.Default.ActiveDataFile); Core.Geocaches.Clear(); Core.Logs.Clear(); Core.Waypoints.Clear(); Core.LogImages.Clear(); Core.UserWaypoints.Clear(); result = true; } } return result; }