From b1bbe63d3023a2674c5cc0a8290607e87917aae4 Mon Sep 17 00:00:00 2001 From: Lysann Schlegel Date: Thu, 1 Aug 2019 14:35:17 +0200 Subject: [PATCH] use saved extraction path when using context menu to extract --- src/RDAExplorerGUI/Misc/RDAFileTreeViewItem.xaml.cs | 5 +++++ src/RDAExplorerGUI/Misc/RDAFolderTreeViewItem.xaml.cs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/RDAExplorerGUI/Misc/RDAFileTreeViewItem.xaml.cs b/src/RDAExplorerGUI/Misc/RDAFileTreeViewItem.xaml.cs index 80909a0..5f4dbdb 100644 --- a/src/RDAExplorerGUI/Misc/RDAFileTreeViewItem.xaml.cs +++ b/src/RDAExplorerGUI/Misc/RDAFileTreeViewItem.xaml.cs @@ -1,6 +1,7 @@ using AnnoModificationManager4.Misc; using AnnoModificationManager4.UserInterface.Misc; using RDAExplorer; +using RDAExplorerGUI.Properties; using System; using System.Diagnostics; using System.IO; @@ -51,10 +52,14 @@ private void FileWatcher_Changed(object sender, FileSystemEventArgs e) private void context_Extract_Click(object sender, RoutedEventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); + saveFileDialog.InitialDirectory = Settings.Default.LastSelectedPathForExtraction; saveFileDialog.FileName = Path.GetFileName(File.FileName); bool? nullable = saveFileDialog.ShowDialog(); if ((!nullable.GetValueOrDefault() ? 0 : (nullable.HasValue ? 1 : 0)) == 0) return; + + Settings.Default.LastSelectedPathForExtraction = Path.GetDirectoryName(saveFileDialog.FileName); // Settings are saved when the application exits + try { File.Extract(saveFileDialog.FileName); diff --git a/src/RDAExplorerGUI/Misc/RDAFolderTreeViewItem.xaml.cs b/src/RDAExplorerGUI/Misc/RDAFolderTreeViewItem.xaml.cs index c851a6d..5ff1c07 100644 --- a/src/RDAExplorerGUI/Misc/RDAFolderTreeViewItem.xaml.cs +++ b/src/RDAExplorerGUI/Misc/RDAFolderTreeViewItem.xaml.cs @@ -3,6 +3,7 @@ using AnnoModificationManager4.UserInterface.Misc; using RDAExplorer; using RDAExplorerGUI.Controls; +using RDAExplorerGUI.Properties; using System; using System.Collections; using System.Collections.Generic; @@ -102,8 +103,12 @@ public RDAFileTreeViewItem SearchFile(string text) private void context_Extract_Click(object sender, RoutedEventArgs e) { FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); + folderBrowserDialog.SelectedPath = Settings.Default.LastSelectedPathForExtraction; if (folderBrowserDialog.ShowDialog() != DialogResult.OK) return; + + Settings.Default.LastSelectedPathForExtraction = folderBrowserDialog.SelectedPath; // Settings are saved when the application exits + BackgroundWorker wrk = new BackgroundWorker(); wrk.WorkerReportsProgress = true; MainWindow.CurrentMainWindow.progressBar_Status.Visibility = Visibility.Visible;