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,25 +60,7 @@ namespace GARbro.GUI
if (!Directory.Exists (destination))
destination = "";
var vm = ViewModel;
if (!vm.IsArchive)
{
if (!entry.IsDirectory)
{
var source = entry.Source.Name;
SetBusyState();
if (string.IsNullOrEmpty (destination))
{
// extract into directory named after archive
if (!string.IsNullOrEmpty (Path.GetExtension (entry.Name)))
destination = Path.GetFileNameWithoutExtension (source);
else
destination = vm.Path.First();
}
extractor = new GarExtract (this, source);
extractor.ExtractAll (destination);
}
}
else if (vm.Path.Count > 1)
if (vm.IsArchive)
{
if (string.IsNullOrEmpty (destination))
destination = Path.GetDirectoryName (vm.Path.First());
@ -89,6 +71,21 @@ namespace GARbro.GUI
else
extractor.Extract (entry, destination);
}
else if (!entry.IsDirectory)
{
var source = entry.Source.Name;
SetBusyState();
if (string.IsNullOrEmpty (destination))
{
// extract into directory named after archive
if (!string.IsNullOrEmpty (Path.GetExtension (entry.Name)))
destination = Path.GetFileNameWithoutExtension (source);
else
destination = vm.Path.First();
}
extractor = new GarExtract (this, source);
extractor.ExtractAll (destination);
}
}
catch (OperationCanceledException X)
{