From 35a6fbe1d6d2a6816c678a1603823cdedbea4a2a Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 13 Apr 2016 12:47:27 -0700 Subject: [PATCH] Limit the number of file types to attempt to parse as archive --- DATFromDir/DATFromDir.cs | 4 +++- SabreHelper/Remapping.cs | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/DATFromDir/DATFromDir.cs b/DATFromDir/DATFromDir.cs index 85f166b9..0c760aad 100644 --- a/DATFromDir/DATFromDir.cs +++ b/DATFromDir/DATFromDir.cs @@ -54,6 +54,8 @@ namespace SabreTools _logger = new Logger(false, "datfromdir.log"); _logger.Start(); + Remapping.CreateArchiveFormats(); + // First things first, take care of all of the arguments that this could have _noMD5 = false; _noSHA1 = false; _forceunzip = false; _allfiles = false; _old = false; _name = ""; _desc = ""; _cat = ""; _version = ""; _author = ""; @@ -289,7 +291,7 @@ namespace SabreTools DirectoryInfo di = Directory.CreateDirectory(_tempDir); bool encounteredErrors = true; - if (!_allfiles) + if (!_allfiles && Remapping.ArchiveFormats.Contains(Path.GetExtension(item).ToLowerInvariant())) { try { diff --git a/SabreHelper/Remapping.cs b/SabreHelper/Remapping.cs index a65256dd..880a41ad 100644 --- a/SabreHelper/Remapping.cs +++ b/SabreHelper/Remapping.cs @@ -28,6 +28,9 @@ namespace SabreTools.Helper public static Dictionary PCE = new Dictionary(); public static Dictionary SNES = new Dictionary(); + // Available archive formats + public static List ArchiveFormats = new List(); + /// /// Create all remappings to be used by the program /// @@ -226,5 +229,12 @@ namespace SabreTools.Helper } } } + + public static void CreateArchiveFormats() + { + ArchiveFormats.Add("7z"); + ArchiveFormats.Add("zip"); + ArchiveFormats.Add("rar"); + } } }