fixed multiple selected files extraction.

This commit is contained in:
morkt 2014-07-30 09:00:26 +04:00
parent 23030ac225
commit 805027ad29
4 changed files with 29 additions and 8 deletions

View File

@ -46,7 +46,10 @@ namespace GARbro.GUI
{ {
var entry = CurrentDirectory.SelectedItem as EntryViewModel; var entry = CurrentDirectory.SelectedItem as EntryViewModel;
if (null == entry && !ViewModel.IsArchive) if (null == entry && !ViewModel.IsArchive)
{
SetStatusText (guiStrings.MsgChooseFiles);
return; return;
}
try try
{ {
if (!ViewModel.IsArchive) if (!ViewModel.IsArchive)
@ -154,12 +157,15 @@ namespace GARbro.GUI
private void ExtractFileFromArchive (EntryViewModel entry, string destination) private void ExtractFileFromArchive (EntryViewModel entry, string destination)
{ {
var vm = ViewModel as ArchiveViewModel; var view_model = ViewModel;
var selected = CurrentDirectory.SelectedItems; var selected = CurrentDirectory.SelectedItems.Cast<EntryViewModel>();
IEnumerable<Entry> file_list = new Entry[0]; IEnumerable<Entry> file_list = view_model.GetFiles (selected);
foreach (var e in selected.Cast<EntryViewModel>()) if (!file_list.Any() && entry.Name == "..")
file_list = view_model.GetFiles (view_model);
if (!file_list.Any())
{ {
file_list = file_list.Concat (vm.GetFiles (e)); SetStatusText (guiStrings.MsgChooseFiles);
return;
} }
string arc_name = Path.GetFileName (CurrentPath); string arc_name = Path.GetFileName (CurrentPath);

View File

@ -286,7 +286,7 @@ namespace GARbro.GUI.Strings {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Extract all files from {0} to. /// Looks up a localized string similar to Extract files from {0} to.
/// </summary> /// </summary>
public static string LabelExtractAllTo { public static string LabelExtractAllTo {
get { get {
@ -330,6 +330,15 @@ namespace GARbro.GUI.Strings {
} }
} }
/// <summary>
/// Looks up a localized string similar to Choose files to extract.
/// </summary>
public static string MsgChooseFiles {
get {
return ResourceManager.GetString("MsgChooseFiles", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Creating archive {0}. /// Looks up a localized string similar to Creating archive {0}.
/// </summary> /// </summary>

View File

@ -193,7 +193,7 @@
<value>Archive options</value> <value>Archive options</value>
</data> </data>
<data name="LabelExtractAllTo" xml:space="preserve"> <data name="LabelExtractAllTo" xml:space="preserve">
<value>Extract all files from {0} to</value> <value>Extract files from {0} to</value>
</data> </data>
<data name="LabelExtractFileTo" xml:space="preserve"> <data name="LabelExtractFileTo" xml:space="preserve">
<value>Extract {0} to</value> <value>Extract {0} to</value>
@ -330,4 +330,7 @@ Overwrite?</value>
<data name="MsgCreatingArchive" xml:space="preserve"> <data name="MsgCreatingArchive" xml:space="preserve">
<value>Creating archive {0}</value> <value>Creating archive {0}</value>
</data> </data>
<data name="MsgChooseFiles" xml:space="preserve">
<value>Choose files to extract</value>
</data>
</root> </root>

View File

@ -190,7 +190,7 @@
<value>Настройки архивирования</value> <value>Настройки архивирования</value>
</data> </data>
<data name="LabelExtractAllTo" xml:space="preserve"> <data name="LabelExtractAllTo" xml:space="preserve">
<value>Извлечь все файлы из {0} в</value> <value>Извлечь файлы из {0} в</value>
</data> </data>
<data name="LabelExtractFileTo" xml:space="preserve"> <data name="LabelExtractFileTo" xml:space="preserve">
<value>Извлечь {0} в</value> <value>Извлечь {0} в</value>
@ -342,4 +342,7 @@
<data name="Type_script" xml:space="preserve"> <data name="Type_script" xml:space="preserve">
<value>сценарий</value> <value>сценарий</value>
</data> </data>
<data name="MsgChooseFiles" xml:space="preserve">
<value>Выберите файлы для извлечения</value>
</data>
</root> </root>