mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 13:45:34 +08:00
remember filename of the last created archive.
This commit is contained in:
parent
bc42670aae
commit
045988301b
@ -64,6 +64,9 @@
|
||||
<setting name="appArchiveFormat" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="appLastCreatedArchive" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</GARbro.GUI.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
|
18
GarCreate.cs
18
GarCreate.cs
@ -33,6 +33,7 @@ using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using GameRes;
|
||||
using GARbro.GUI.Strings;
|
||||
using GARbro.GUI.Properties;
|
||||
using Ookii.Dialogs.Wpf;
|
||||
|
||||
namespace GARbro.GUI
|
||||
@ -71,18 +72,22 @@ namespace GARbro.GUI
|
||||
public GarCreate (MainWindow parent)
|
||||
{
|
||||
m_main = parent;
|
||||
m_arc_name = Settings.Default.appLastCreatedArchive;
|
||||
}
|
||||
|
||||
public bool Run ()
|
||||
{
|
||||
Directory.SetCurrentDirectory (m_main.CurrentPath);
|
||||
var items = m_main.CurrentDirectory.SelectedItems.Cast<EntryViewModel>();
|
||||
m_arc_name = Path.GetFileName (m_main.CurrentPath);
|
||||
if (!items.Skip (1).Any()) // items.Count() == 1
|
||||
var items = m_main.CurrentDirectory.SelectedItems.Cast<EntryViewModel> ();
|
||||
if (string.IsNullOrEmpty (m_arc_name))
|
||||
{
|
||||
var item = items.First();
|
||||
if (item.IsDirectory)
|
||||
m_arc_name = Path.GetFileNameWithoutExtension (item.Name);
|
||||
m_arc_name = Path.GetFileName (m_main.CurrentPath);
|
||||
if (!items.Skip (1).Any()) // items.Count() == 1
|
||||
{
|
||||
var item = items.First();
|
||||
if (item.IsDirectory)
|
||||
m_arc_name = Path.GetFileNameWithoutExtension (item.Name);
|
||||
}
|
||||
}
|
||||
|
||||
var dialog = new CreateArchiveDialog (m_arc_name);
|
||||
@ -181,6 +186,7 @@ namespace GARbro.GUI
|
||||
m_progress_dialog.Dispose();
|
||||
if (null == m_pending_error)
|
||||
{
|
||||
Settings.Default.appLastCreatedArchive = m_arc_name;
|
||||
m_main.Dispatcher.Invoke (() => {
|
||||
m_main.SaveCurrentPosition();
|
||||
m_main.SetCurrentPosition (new DirectoryPosition (m_arc_name));
|
||||
|
12
Properties/Settings.Designer.cs
generated
12
Properties/Settings.Designer.cs
generated
@ -249,5 +249,17 @@ namespace GARbro.GUI.Properties {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,5 +59,8 @@
|
||||
<Setting Name="appRecentFiles" Type="System.Collections.Specialized.StringCollection" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="appLastCreatedArchive" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
Loading…
Reference in New Issue
Block a user