mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Added 7zip archive test before extraction for .dat files
This commit is contained in:
parent
77539b6142
commit
d2a80b25c6
@ -20,7 +20,10 @@ namespace Wabbajack.Common
|
||||
|
||||
public static string MegaPrefix = "https://mega.nz/#!";
|
||||
|
||||
public static HashSet<string> SupportedArchives = new HashSet<string> {".zip", ".rar", ".7z", ".7zip", ".fomod", ".omod", ".exe"};
|
||||
public static HashSet<string> SupportedArchives = new HashSet<string> {".zip", ".rar", ".7z", ".7zip", ".fomod", ".omod", ".exe", ".dat"};
|
||||
|
||||
// HashSet with archive extensions that need to be tested before extraction
|
||||
public static HashSet<string> TestArchivesBeforeExtraction = new HashSet<string> {".dat"};
|
||||
|
||||
public static HashSet<string> SupportedBSAs = new HashSet<string> {".bsa", ".ba2", ".BA2"};
|
||||
|
||||
|
@ -160,6 +160,47 @@ namespace Wabbajack.Common
|
||||
|
||||
private static void ExtractAllWith7Zip(string source, string dest)
|
||||
{
|
||||
if (Consts.TestArchivesBeforeExtraction.Contains(Path.GetExtension(source)))
|
||||
{
|
||||
Utils.Log(new GenericInfo($"Testing archive {Path.GetFileName(source)}", $"The archive {source} is being tested using 7zip.exe"));
|
||||
var testInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "7z.exe",
|
||||
Arguments = $"t \"{source}\"",
|
||||
RedirectStandardError = true,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
var testP = new Process {StartInfo = testInfo};
|
||||
|
||||
testP.Start();
|
||||
ChildProcessTracker.AddProcess(testP);
|
||||
try
|
||||
{
|
||||
testP.PriorityClass = ProcessPriorityClass.BelowNormal;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
while (!testP.HasExited)
|
||||
{
|
||||
var line = testP.StandardOutput.ReadLine();
|
||||
if (line == null)
|
||||
break;
|
||||
}
|
||||
} catch (Exception){}
|
||||
|
||||
testP.WaitForExit();
|
||||
if (testP.ExitCode != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
Utils.Log(new GenericInfo($"Extracting {Path.GetFileName(source)}", $"The contents of {source} are being extracted to {dest} using 7zip.exe"));
|
||||
|
||||
var info = new ProcessStartInfo
|
||||
|
Loading…
x
Reference in New Issue
Block a user