Use linq in extract method

This commit is contained in:
Jaex 2020-06-17 09:53:24 +03:00
parent b2c6e9fd25
commit b3bcffbde0

View file

@ -27,6 +27,7 @@ You should have received a copy of the GNU General Public License
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
namespace ShareX.HelpersLib
{
@ -42,23 +43,9 @@ public static void Extract(string archivePath, string destination, bool retainDi
{
string entryName = entry.Name;
if (fileFilter != null)
if (fileFilter != null && !fileFilter.Any(x => x.Equals(entryName, StringComparison.OrdinalIgnoreCase)))
{
bool match = false;
foreach (string file in fileFilter)
{
if (file.Equals(entryName, StringComparison.OrdinalIgnoreCase))
{
match = true;
break;
}
}
if (!match)
{
continue;
}
continue;
}
if (retainDirectoryStructure)