# HG changeset patch # User IBBoard # Date 1315165424 -3600 # Node ID c70973b65090c99c8237b4474a47e7e2b2ac64f7 # Parent 131fb56da842a33d19418353c68606962639fe99 Fixes #94: Loading files is too slow * Check file extensions to cut down on false-positive file loads. NOTE: This solution isn't ideal, but SharpZipLib has a FIXME in that their scan will be slow on non-zips. diff -r 131fb56da842 -r c70973b65090 API/Factories/AbstractNativeWarFoundryFactory.cs --- a/API/Factories/AbstractNativeWarFoundryFactory.cs Wed Aug 31 13:57:27 2011 +0100 +++ b/API/Factories/AbstractNativeWarFoundryFactory.cs Sun Sep 04 20:43:44 2011 +0100 @@ -29,22 +29,25 @@ } protected override ZipFile GetFileAsSupportedType (FileInfo file) - { - ZipFile zip = null; - - try - { - zip = new ZipFile(file.FullName); + { + ZipFile zip = null; + string ext = file.Extension; + + if (ext == "race" || ext == "army" || ext == "system") + { + try + { + zip = new ZipFile(file.FullName); + } + catch (ZipException) + { + //Silently dispose as per spec for the method + } + catch (IOException) + { + //Silently dispose as per spec for the method + } } - catch(ZipException) - { - //Silently dispose as per spec for the method - } - catch (IOException) - { - //Silently dispose as per spec for the method - } - return zip; }