mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
commit
ea1d275a16
@ -20,7 +20,7 @@ namespace Wabbajack.Common
|
|||||||
|
|
||||||
public static string MegaPrefix = "https://mega.nz/#!";
|
public static string MegaPrefix = "https://mega.nz/#!";
|
||||||
|
|
||||||
public static HashSet<string> SupportedArchives = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {".zip", ".rar", ".7z", ".7zip", ".fomod", ".omod", ".exe", ".dat"};
|
public static HashSet<string> SupportedArchives = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {".zip", ".rar", ".7z", ".7zip", ".fomod", ".omod", ".exe", ".dat", ".gz", ".tar"};
|
||||||
|
|
||||||
// HashSet with archive extensions that need to be tested before extraction
|
// HashSet with archive extensions that need to be tested before extraction
|
||||||
public static HashSet<string> TestArchivesBeforeExtraction = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {".dat"};
|
public static HashSet<string> TestArchivesBeforeExtraction = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {".dat"};
|
||||||
|
@ -25,7 +25,7 @@ namespace Wabbajack.VirtualFileSystem
|
|||||||
else if (source.EndsWith(".omod"))
|
else if (source.EndsWith(".omod"))
|
||||||
ExtractAllWithOMOD(source, dest);
|
ExtractAllWithOMOD(source, dest);
|
||||||
else if (source.EndsWith(".exe"))
|
else if (source.EndsWith(".exe"))
|
||||||
ExtractAllWithInno(source, dest);
|
ExtractAllEXE(source, dest);
|
||||||
else
|
else
|
||||||
ExtractAllWith7Zip(source, dest);
|
ExtractAllWith7Zip(source, dest);
|
||||||
}
|
}
|
||||||
@ -35,8 +35,16 @@ namespace Wabbajack.VirtualFileSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ExtractAllWithInno(string source, string dest)
|
private static void ExtractAllEXE(string source, string dest)
|
||||||
{
|
{
|
||||||
|
var isArchive = TestWith7z(source);
|
||||||
|
|
||||||
|
if (isArchive)
|
||||||
|
{
|
||||||
|
ExtractAllWith7Zip(source, dest);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Utils.Log($"Extracting {Path.GetFileName(source)}");
|
Utils.Log($"Extracting {Path.GetFileName(source)}");
|
||||||
|
|
||||||
var info = new ProcessStartInfo
|
var info = new ProcessStartInfo
|
||||||
@ -225,46 +233,50 @@ namespace Wabbajack.VirtualFileSystem
|
|||||||
if(ext != ".exe" && !Consts.TestArchivesBeforeExtraction.Contains(ext))
|
if(ext != ".exe" && !Consts.TestArchivesBeforeExtraction.Contains(ext))
|
||||||
return Consts.SupportedArchives.Contains(ext) || Consts.SupportedBSAs.Contains(ext);
|
return Consts.SupportedArchives.Contains(ext) || Consts.SupportedBSAs.Contains(ext);
|
||||||
|
|
||||||
if (ext == ".exe")
|
var isArchive = TestWith7z(v);
|
||||||
|
|
||||||
|
if (isArchive)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
var info = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
var info = new ProcessStartInfo
|
FileName = @"Extractors\innounp.exe",
|
||||||
{
|
Arguments = $"-t \"{v}\" ",
|
||||||
FileName = @"Extractors\innounp.exe",
|
RedirectStandardError = true,
|
||||||
Arguments = $"-t \"{v}\" ",
|
RedirectStandardInput = true,
|
||||||
RedirectStandardError = true,
|
RedirectStandardOutput = true,
|
||||||
RedirectStandardInput = true,
|
UseShellExecute = false,
|
||||||
RedirectStandardOutput = true,
|
CreateNoWindow = true
|
||||||
UseShellExecute = false,
|
};
|
||||||
CreateNoWindow = true
|
|
||||||
};
|
|
||||||
|
|
||||||
var p = new Process {StartInfo = info};
|
var p = new Process {StartInfo = info};
|
||||||
|
|
||||||
p.Start();
|
p.Start();
|
||||||
ChildProcessTracker.AddProcess(p);
|
ChildProcessTracker.AddProcess(p);
|
||||||
|
|
||||||
var name = Path.GetFileName(v);
|
var name = Path.GetFileName(v);
|
||||||
while (!p.HasExited)
|
while (!p.HasExited)
|
||||||
{
|
{
|
||||||
var line = p.StandardOutput.ReadLine();
|
var line = p.StandardOutput.ReadLine();
|
||||||
if (line == null)
|
if (line == null)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (line[0] != '#')
|
if (line[0] != '#')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Utils.Status($"Testing {name} - {line.Trim()}");
|
Utils.Status($"Testing {name} - {line.Trim()}");
|
||||||
}
|
|
||||||
|
|
||||||
p.WaitForExitAndWarn(TimeSpan.FromSeconds(30), $"Testing {name}");
|
|
||||||
return p.ExitCode == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.WaitForExitAndWarn(TimeSpan.FromSeconds(30), $"Testing {name}");
|
||||||
|
return p.ExitCode == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TestWith7z(string file)
|
||||||
|
{
|
||||||
var testInfo = new ProcessStartInfo
|
var testInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = @"Extractors\7z.exe",
|
FileName = @"Extractors\7z.exe",
|
||||||
Arguments = $"t \"{v}\"",
|
Arguments = $"t \"{file}\"",
|
||||||
RedirectStandardError = true,
|
RedirectStandardError = true,
|
||||||
RedirectStandardInput = true,
|
RedirectStandardInput = true,
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true,
|
||||||
@ -282,6 +294,7 @@ namespace Wabbajack.VirtualFileSystem
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -292,13 +305,16 @@ namespace Wabbajack.VirtualFileSystem
|
|||||||
if (line == null)
|
if (line == null)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (Exception){}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
testP.WaitForExitAndWarn(TimeSpan.FromSeconds(30), $"Can Extract Check {v}");
|
testP.WaitForExitAndWarn(TimeSpan.FromSeconds(30), $"Can Extract Check {file}");
|
||||||
return testP.ExitCode == 0;
|
return testP.ExitCode == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static bool MightBeArchive(string path)
|
public static bool MightBeArchive(string path)
|
||||||
{
|
{
|
||||||
var ext = Path.GetExtension(path.ToLower());
|
var ext = Path.GetExtension(path.ToLower());
|
||||||
|
Loading…
Reference in New Issue
Block a user