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;
if (null == entry && !ViewModel.IsArchive)
{
SetStatusText (guiStrings.MsgChooseFiles);
return;
}
try
{
if (!ViewModel.IsArchive)
@ -154,12 +157,15 @@ namespace GARbro.GUI
private void ExtractFileFromArchive (EntryViewModel entry, string destination)
{
var vm = ViewModel as ArchiveViewModel;
var selected = CurrentDirectory.SelectedItems;
IEnumerable<Entry> file_list = new Entry[0];
foreach (var e in selected.Cast<EntryViewModel>())
var view_model = ViewModel;
var selected = CurrentDirectory.SelectedItems.Cast<EntryViewModel>();
IEnumerable<Entry> file_list = view_model.GetFiles (selected);
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);

View File

@ -286,7 +286,7 @@ namespace GARbro.GUI.Strings {
}
/// <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>
public static string LabelExtractAllTo {
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>
/// Looks up a localized string similar to Creating archive {0}.
/// </summary>

View File

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

View File

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