Skip to content

Commit

Permalink
Merge pull request #13 from FroggieFrog/remember-extraction-directory
Browse files Browse the repository at this point in the history
remember last selected directory for extraction
  • Loading branch information
Lysann Schlegel authored Aug 1, 2019
2 parents adf7c14 + 7a89377 commit a7a6829
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/RDAExplorerGUI/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
<setting name="Window_IsMaximized" serializeAs="String">
<value>True</value>
</setting>
<setting name="LastSelectedPathForExtraction" serializeAs="String">
<value />
</setting>
<setting name="SettingsUpgradeNeeded" serializeAs="String">
<value>True</value>
</setting>
</RDAExplorerGUI.Properties.Settings>
</userSettings>
</configuration>
18 changes: 17 additions & 1 deletion src/RDAExplorerGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ public MainWindow()
private void Window_Loaded(object sender, RoutedEventArgs e)
{
NewFile();

if (Settings.Default.SettingsUpgradeNeeded)
{
Settings.Default.Upgrade();
Settings.Default.SettingsUpgradeNeeded = false;
Settings.Default.Save();
}
}

private void MainWindow_Closing(object sender, CancelEventArgs e)
Expand Down Expand Up @@ -125,7 +132,8 @@ private void _RebuildTreeView(BackgroundWorker wrk)
foreach (RDASkippedDataSection skippedBlock in CurrentReader.SkippedDataSections)
{
string title = skippedBlock.blockInfo.fileCount + " encrypted files";
treeView.Items.Add(new RDASkippedDataSectionTreeViewItem() {
treeView.Items.Add(new RDASkippedDataSectionTreeViewItem()
{
Section = skippedBlock,
Header = ControlExtension.BuildImageTextblock("pack://application:,,,/Images/Icons/error.png", title)
});
Expand Down Expand Up @@ -333,8 +341,12 @@ private void file_Exit_Click(object sender, RoutedEventArgs e)
private void archive_ExtractAll_Click(object sender, RoutedEventArgs e)
{
FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.SelectedPath = Settings.Default.LastSelectedPathForExtraction;
if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;

Settings.Default.LastSelectedPathForExtraction = dlg.SelectedPath;//settings are saved when window is closing

BackgroundWorker wrk = new BackgroundWorker();
wrk.WorkerReportsProgress = true;
progressBar_Status.Visibility = Visibility.Visible;
Expand Down Expand Up @@ -366,8 +378,12 @@ private void archive_ExtractAll_Click(object sender, RoutedEventArgs e)
private void archive_ExtractSelected_Click(object sender, RoutedEventArgs e)
{
FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.SelectedPath = Settings.Default.LastSelectedPathForExtraction;
if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;

Settings.Default.LastSelectedPathForExtraction = dlg.SelectedPath;//settings are saved when window is closing

BackgroundWorker wrk = new BackgroundWorker();
wrk.WorkerReportsProgress = true;
progressBar_Status.Visibility = Visibility.Visible;
Expand Down
24 changes: 24 additions & 0 deletions src/RDAExplorerGUI/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/RDAExplorerGUI/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
<Setting Name="Window_IsMaximized" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="LastSelectedPathForExtraction" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="SettingsUpgradeNeeded" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>

0 comments on commit a7a6829

Please sign in to comment.