mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Update OMODFramework to 3.x
This commit is contained in:
parent
5092d6325c
commit
e7b7e51953
@ -120,47 +120,31 @@ namespace Wabbajack.VirtualFileSystem
|
|||||||
var dest = await TempFolder.Create();
|
var dest = await TempFolder.Create();
|
||||||
Utils.Log($"Extracting {(string)tmpFile.Path}");
|
Utils.Log($"Extracting {(string)tmpFile.Path}");
|
||||||
|
|
||||||
Framework.Settings.TempPath = (string)dest.Dir;
|
using var omod = new OMOD((string) tmpFile.Path);
|
||||||
Framework.Settings.CodeProgress = new OMODProgress();
|
|
||||||
|
|
||||||
var omod = new OMOD((string)tmpFile.Path);
|
|
||||||
omod.GetDataFiles();
|
|
||||||
omod.GetPlugins();
|
|
||||||
|
|
||||||
var results = new Dictionary<RelativePath, T>();
|
var results = new Dictionary<RelativePath, T>();
|
||||||
foreach (var file in dest.Dir.EnumerateFiles())
|
|
||||||
{
|
|
||||||
var path = file.RelativeTo(dest.Dir);
|
|
||||||
if (!shouldExtract(path)) continue;
|
|
||||||
|
|
||||||
var result = await mapfn(path, new ExtractedNativeFile(file));
|
omod.ExtractFilesParallel((string) dest.Dir, 4);
|
||||||
results.Add(path, result);
|
if (omod.HasEntryFile(OMODEntryFileType.PluginsCRC))
|
||||||
|
omod.ExtractFiles(false, (string) dest.Dir);
|
||||||
|
|
||||||
|
var files = omod.GetDataFiles();
|
||||||
|
if (omod.HasEntryFile(OMODEntryFileType.PluginsCRC))
|
||||||
|
files.UnionWith(omod.GetPluginFiles());
|
||||||
|
|
||||||
|
foreach (var compressedFile in files)
|
||||||
|
{
|
||||||
|
var abs = compressedFile.Name.RelativeTo(dest.Dir);
|
||||||
|
var rel = abs.RelativeTo(dest.Dir);
|
||||||
|
if (!shouldExtract(rel)) continue;
|
||||||
|
|
||||||
|
var result = await mapfn(rel, new ExtractedNativeFile(abs));
|
||||||
|
results.Add(rel, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OMODProgress : ICodeProgress
|
|
||||||
{
|
|
||||||
private long _total;
|
|
||||||
|
|
||||||
public void SetProgress(long inSize, long outSize)
|
|
||||||
{
|
|
||||||
Utils.Status("Extracting OMOD", Percent.FactoryPutInRange(inSize, _total));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Init(long totalSize, bool compressing)
|
|
||||||
{
|
|
||||||
_total = totalSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static async Task<Dictionary<RelativePath,T>> GatheringExtractWithBSA<T>(IStreamFactory sFn, Definitions.FileType sig, Predicate<RelativePath> shouldExtract, Func<RelativePath,IExtractedFile,ValueTask<T>> mapfn)
|
private static async Task<Dictionary<RelativePath,T>> GatheringExtractWithBSA<T>(IStreamFactory sFn, Definitions.FileType sig, Predicate<RelativePath> shouldExtract, Func<RelativePath,IExtractedFile,ValueTask<T>> mapfn)
|
||||||
{
|
{
|
||||||
var archive = await BSADispatch.OpenRead(sFn, sig);
|
var archive = await BSADispatch.OpenRead(sFn, sig);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Genbox.AlphaFS" Version="2.2.2.1" />
|
<PackageReference Include="Genbox.AlphaFS" Version="2.2.2.1" />
|
||||||
<PackageReference Include="K4os.Hash.Crc" Version="1.1.4" />
|
<PackageReference Include="K4os.Hash.Crc" Version="1.1.4" />
|
||||||
<PackageReference Include="OMODFramework" Version="2.2.0" />
|
<PackageReference Include="OMODFramework" Version="3.0.1" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.28.1" />
|
<PackageReference Include="SharpCompress" Version="0.28.1" />
|
||||||
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
|
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user