remember filename of the last created archive.

This commit is contained in:
morkt 2014-08-01 17:09:15 +04:00
parent bc42670aae
commit 045988301b
4 changed files with 30 additions and 6 deletions

View File

@ -64,6 +64,9 @@
<setting name="appArchiveFormat" serializeAs="String"> <setting name="appArchiveFormat" serializeAs="String">
<value /> <value />
</setting> </setting>
<setting name="appLastCreatedArchive" serializeAs="String">
<value />
</setting>
</GARbro.GUI.Properties.Settings> </GARbro.GUI.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>

View File

@ -33,6 +33,7 @@ using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using GameRes; using GameRes;
using GARbro.GUI.Strings; using GARbro.GUI.Strings;
using GARbro.GUI.Properties;
using Ookii.Dialogs.Wpf; using Ookii.Dialogs.Wpf;
namespace GARbro.GUI namespace GARbro.GUI
@ -71,12 +72,15 @@ namespace GARbro.GUI
public GarCreate (MainWindow parent) public GarCreate (MainWindow parent)
{ {
m_main = parent; m_main = parent;
m_arc_name = Settings.Default.appLastCreatedArchive;
} }
public bool Run () public bool Run ()
{ {
Directory.SetCurrentDirectory (m_main.CurrentPath); Directory.SetCurrentDirectory (m_main.CurrentPath);
var items = m_main.CurrentDirectory.SelectedItems.Cast<EntryViewModel>(); var items = m_main.CurrentDirectory.SelectedItems.Cast<EntryViewModel> ();
if (string.IsNullOrEmpty (m_arc_name))
{
m_arc_name = Path.GetFileName (m_main.CurrentPath); m_arc_name = Path.GetFileName (m_main.CurrentPath);
if (!items.Skip (1).Any()) // items.Count() == 1 if (!items.Skip (1).Any()) // items.Count() == 1
{ {
@ -84,6 +88,7 @@ namespace GARbro.GUI
if (item.IsDirectory) if (item.IsDirectory)
m_arc_name = Path.GetFileNameWithoutExtension (item.Name); m_arc_name = Path.GetFileNameWithoutExtension (item.Name);
} }
}
var dialog = new CreateArchiveDialog (m_arc_name); var dialog = new CreateArchiveDialog (m_arc_name);
dialog.Owner = m_main; dialog.Owner = m_main;
@ -181,6 +186,7 @@ namespace GARbro.GUI
m_progress_dialog.Dispose(); m_progress_dialog.Dispose();
if (null == m_pending_error) if (null == m_pending_error)
{ {
Settings.Default.appLastCreatedArchive = m_arc_name;
m_main.Dispatcher.Invoke (() => { m_main.Dispatcher.Invoke (() => {
m_main.SaveCurrentPosition(); m_main.SaveCurrentPosition();
m_main.SetCurrentPosition (new DirectoryPosition (m_arc_name)); m_main.SetCurrentPosition (new DirectoryPosition (m_arc_name));

View File

@ -249,5 +249,17 @@ namespace GARbro.GUI.Properties {
this["appRecentFiles"] = value; this["appRecentFiles"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string appLastCreatedArchive {
get {
return ((string)(this["appLastCreatedArchive"]));
}
set {
this["appLastCreatedArchive"] = value;
}
}
} }
} }

View File

@ -59,5 +59,8 @@
<Setting Name="appRecentFiles" Type="System.Collections.Specialized.StringCollection" Scope="User"> <Setting Name="appRecentFiles" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)" />
</Setting> </Setting>
<Setting Name="appLastCreatedArchive" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>