Rearrange statements, preserving execution order

This commit is contained in:
YoshiRulz 2021-01-20 16:32:34 +10:00
parent 55e066a0cc
commit 1ccac956d8
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 14 additions and 10 deletions

View File

@ -180,26 +180,30 @@ namespace BizHawk.Common
if (!_rootExists) return this;
if (_boundStream != null) throw new InvalidOperationException("stream already bound!");
if (_archiveItems == null || _extractor == null)
{
// open uncompressed file
if (extensions.Length == 0
|| extensions.Contains(Path.GetExtension(FullPathWithoutMember).ToLowerInvariant()))
{
BindRoot();
}
}
else
if (!(_archiveItems == null || _extractor == null))
{
if (extensions.Length != 0)
{
var candidates = _archiveItems.Where(item => extensions.Contains(Path.GetExtension(item.Name).ToLowerInvariant())).ToList();
if (onlyBindSingle ? candidates.Count == 1 : candidates.Count != 0) BindArchiveMember(candidates[0].Index);
return this;
}
else if (!onlyBindSingle || _archiveItems.Count == 1)
{
BindArchiveMember(0);
return this;
}
else
{
return this;
}
}
// open uncompressed file
if (extensions.Length == 0
|| extensions.Contains(Path.GetExtension(FullPathWithoutMember).ToLowerInvariant()))
{
BindRoot();
}
return this;