mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
support auto extraction exes as archive sources
This commit is contained in:
parent
05a0fec7fd
commit
24c948f138
@ -8,10 +8,10 @@ namespace VirtualFileSystem.Test
|
|||||||
private static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Utils.SetLoggerFn(s => Console.WriteLine(s));
|
Utils.SetLoggerFn(s => Console.WriteLine(s));
|
||||||
Utils.SetStatusFn((s, i) => Console.WriteLine(s));
|
Utils.SetStatusFn((s, i) => Console.Write(s + "\r"));
|
||||||
WorkQueue.Init((a, b, c) => { },
|
WorkQueue.Init((a, b, c) => { },
|
||||||
(a, b) => { });
|
(a, b) => { });
|
||||||
VFS.VirtualFileSystem.VFS.AddRoot(@"D:\tmp\Interesting NPCs SSE 3.42\Data");
|
VFS.VirtualFileSystem.VFS.AddRoot(@"D:\tmp\archivetests");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ namespace Wabbajack.Common
|
|||||||
public static string BSACreationDir = "TEMP_BSA_FILES";
|
public static string BSACreationDir = "TEMP_BSA_FILES";
|
||||||
public static string MegaPrefix = "https://mega.nz/#!";
|
public static string MegaPrefix = "https://mega.nz/#!";
|
||||||
|
|
||||||
public static HashSet<string> SupportedArchives = new HashSet<string> {".zip", ".rar", ".7z", ".7zip", ".fomod"};
|
public static HashSet<string> SupportedArchives = new HashSet<string> {".zip", ".rar", ".7z", ".7zip", ".fomod", ".exe"};
|
||||||
public static HashSet<string> SupportedBSAs = new HashSet<string> {".bsa"};
|
public static HashSet<string> SupportedBSAs = new HashSet<string> {".bsa"};
|
||||||
|
|
||||||
public static HashSet<string> ConfigFileExtensions = new HashSet<string> {".json", ".ini", ".yml"};
|
public static HashSet<string> ConfigFileExtensions = new HashSet<string> {".json", ".ini", ".yml"};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Compression.BSA;
|
using Compression.BSA;
|
||||||
@ -13,6 +14,7 @@ namespace Wabbajack.Common
|
|||||||
{
|
{
|
||||||
ExtractResource("Wabbajack.Common.7z.dll.gz", "7z.dll");
|
ExtractResource("Wabbajack.Common.7z.dll.gz", "7z.dll");
|
||||||
ExtractResource("Wabbajack.Common.7z.exe.gz", "7z.exe");
|
ExtractResource("Wabbajack.Common.7z.exe.gz", "7z.exe");
|
||||||
|
ExtractResource("Wabbajack.Common.innounp.exe.gz", "innounp.exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ExtractResource(string from, string to)
|
private static void ExtractResource(string from, string to)
|
||||||
@ -34,6 +36,8 @@ namespace Wabbajack.Common
|
|||||||
{
|
{
|
||||||
if (source.EndsWith(".bsa"))
|
if (source.EndsWith(".bsa"))
|
||||||
ExtractAllWithBSA(source, dest);
|
ExtractAllWithBSA(source, dest);
|
||||||
|
if (source.EndsWith(".exe"))
|
||||||
|
ExtractAllWithInno(source, dest);
|
||||||
else
|
else
|
||||||
ExtractAllWith7Zip(source, dest);
|
ExtractAllWith7Zip(source, dest);
|
||||||
}
|
}
|
||||||
@ -134,6 +138,64 @@ namespace Wabbajack.Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ExtractAllWithInno(string source, string dest)
|
||||||
|
{
|
||||||
|
Utils.Log($"Extracting {Path.GetFileName(source)}");
|
||||||
|
|
||||||
|
var info = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "innounp.exe",
|
||||||
|
Arguments = $"-x -y -b -d\"{dest}\" \"{source}\"",
|
||||||
|
RedirectStandardError = true,
|
||||||
|
RedirectStandardInput = true,
|
||||||
|
RedirectStandardOutput = true,
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var p = new Process
|
||||||
|
{
|
||||||
|
StartInfo = info
|
||||||
|
};
|
||||||
|
|
||||||
|
p.Start();
|
||||||
|
ChildProcessTracker.AddProcess(p);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
p.PriorityClass = ProcessPriorityClass.BelowNormal;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
var name = Path.GetFileName(source);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
while (!p.HasExited)
|
||||||
|
{
|
||||||
|
var line = p.StandardOutput.ReadLine();
|
||||||
|
if (line == null)
|
||||||
|
break;
|
||||||
|
var percent = 0;
|
||||||
|
if (line.Length > 4 && line[3] == '%')
|
||||||
|
{
|
||||||
|
int.TryParse(line.Substring(0, 3), out percent);
|
||||||
|
Utils.Status($"Extracting {name} - {line.Trim()}", percent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
p.WaitForExit();
|
||||||
|
if (p.ExitCode != 0)
|
||||||
|
{
|
||||||
|
Utils.Log(p.StandardOutput.ReadToEnd());
|
||||||
|
Utils.Log($"Extraction error extracting {source}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if the given extension type can be extracted
|
/// Returns true if the given extension type can be extracted
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -99,6 +99,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="7z.dll.gz" />
|
<EmbeddedResource Include="7z.dll.gz" />
|
||||||
<EmbeddedResource Include="7z.exe.gz" />
|
<EmbeddedResource Include="7z.exe.gz" />
|
||||||
|
<EmbeddedResource Include="innounp.exe.gz" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -110,6 +111,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="7z.dll" />
|
<Content Include="7z.dll" />
|
||||||
<Content Include="7z.exe" />
|
<Content Include="7z.exe" />
|
||||||
|
<Content Include="innounp.exe" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
BIN
Wabbajack.Common/innounp.exe
Normal file
BIN
Wabbajack.Common/innounp.exe
Normal file
Binary file not shown.
BIN
Wabbajack.Common/innounp.exe.gz
Normal file
BIN
Wabbajack.Common/innounp.exe.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user