mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Signature-based instead of extension-based
This commit is contained in:
@@ -54,8 +54,6 @@ namespace SabreTools
|
|||||||
_logger = new Logger(false, "datfromdir.log");
|
_logger = new Logger(false, "datfromdir.log");
|
||||||
_logger.Start();
|
_logger.Start();
|
||||||
|
|
||||||
Remapping.CreateArchiveFormats();
|
|
||||||
|
|
||||||
// First things first, take care of all of the arguments that this could have
|
// First things first, take care of all of the arguments that this could have
|
||||||
_noMD5 = false; _noSHA1 = false; _forceunzip = false; _allfiles = false; _old = false;
|
_noMD5 = false; _noSHA1 = false; _forceunzip = false; _allfiles = false; _old = false;
|
||||||
_name = ""; _desc = ""; _cat = ""; _version = ""; _author = "";
|
_name = ""; _desc = ""; _cat = ""; _version = ""; _author = "";
|
||||||
@@ -291,16 +289,21 @@ namespace SabreTools
|
|||||||
DirectoryInfo di = Directory.CreateDirectory(_tempDir);
|
DirectoryInfo di = Directory.CreateDirectory(_tempDir);
|
||||||
|
|
||||||
bool encounteredErrors = true;
|
bool encounteredErrors = true;
|
||||||
if (!_allfiles && Remapping.ArchiveFormats.Contains(Path.GetExtension(item).ToLowerInvariant()))
|
if (!_allfiles)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IArchive archive = ArchiveFactory.Open(item);
|
IArchive archive = ArchiveFactory.Open(item);
|
||||||
_logger.Log("Found archive of type: " + archive.Type);
|
ArchiveType at = archive.Type;
|
||||||
|
_logger.Log("Found archive of type: " + at);
|
||||||
|
|
||||||
|
if (at == ArchiveType.Zip || at == ArchiveType.SevenZip || at == ArchiveType.Rar)
|
||||||
|
{
|
||||||
IReader reader = archive.ExtractAllEntries();
|
IReader reader = archive.ExtractAllEntries();
|
||||||
reader.WriteAllToDirectory(_tempDir, ExtractOptions.ExtractFullPath);
|
reader.WriteAllToDirectory(_tempDir, ExtractOptions.ExtractFullPath);
|
||||||
encounteredErrors = false;
|
encounteredErrors = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (InvalidOperationException)
|
catch (InvalidOperationException)
|
||||||
{
|
{
|
||||||
encounteredErrors = true;
|
encounteredErrors = true;
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ namespace SabreTools.Helper
|
|||||||
public static Dictionary<string, int> PCE = new Dictionary<string, int>();
|
public static Dictionary<string, int> PCE = new Dictionary<string, int>();
|
||||||
public static Dictionary<string, int> SNES = new Dictionary<string, int>();
|
public static Dictionary<string, int> SNES = new Dictionary<string, int>();
|
||||||
|
|
||||||
// Available archive formats
|
|
||||||
public static List<string> ArchiveFormats = new List<string>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create all remappings to be used by the program
|
/// Create all remappings to be used by the program
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -229,12 +226,5 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateArchiveFormats()
|
|
||||||
{
|
|
||||||
ArchiveFormats.Add("7z");
|
|
||||||
ArchiveFormats.Add("zip");
|
|
||||||
ArchiveFormats.Add("rar");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user