tweaked if/else branching.

This commit is contained in:
morkt 2015-09-17 04:25:36 +04:00
parent 4a7678c3cd
commit eef86f0804

View File

@ -60,9 +60,18 @@ namespace GARbro.GUI
if (!Directory.Exists (destination))
destination = "";
var vm = ViewModel;
if (!vm.IsArchive)
if (vm.IsArchive)
{
if (!entry.IsDirectory)
if (string.IsNullOrEmpty (destination))
destination = Path.GetDirectoryName (vm.Path.First());
var archive_name = vm.Path[vm.Path.Count-2];
extractor = new GarExtract (this, archive_name, VFS.Top as ArchiveFileSystem);
if (null == entry || (entry.Name == ".." && string.IsNullOrEmpty (vm.Path.Last()))) // root entry
extractor.ExtractAll (destination);
else
extractor.Extract (entry, destination);
}
else if (!entry.IsDirectory)
{
var source = entry.Source.Name;
SetBusyState();
@ -78,18 +87,6 @@ namespace GARbro.GUI
extractor.ExtractAll (destination);
}
}
else if (vm.Path.Count > 1)
{
if (string.IsNullOrEmpty (destination))
destination = Path.GetDirectoryName (vm.Path.First());
var archive_name = vm.Path[vm.Path.Count-2];
extractor = new GarExtract (this, archive_name, VFS.Top as ArchiveFileSystem);
if (null == entry || (entry.Name == ".." && string.IsNullOrEmpty (vm.Path.Last()))) // root entry
extractor.ExtractAll (destination);
else
extractor.Extract (entry, destination);
}
}
catch (OperationCanceledException X)
{
SetStatusText (X.Message);