mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #1393 from erri120/update-omodframework
Update OMODFramework to 3.x
This commit is contained in:
commit
f8725c3afa
@ -120,47 +120,31 @@ namespace Wabbajack.VirtualFileSystem
|
||||
var dest = await TempFolder.Create();
|
||||
Utils.Log($"Extracting {(string)tmpFile.Path}");
|
||||
|
||||
Framework.Settings.TempPath = (string)dest.Dir;
|
||||
Framework.Settings.CodeProgress = new OMODProgress();
|
||||
|
||||
var omod = new OMOD((string)tmpFile.Path);
|
||||
omod.GetDataFiles();
|
||||
omod.GetPlugins();
|
||||
using var omod = new OMOD((string) tmpFile.Path);
|
||||
|
||||
var results = new Dictionary<RelativePath, T>();
|
||||
foreach (var file in dest.Dir.EnumerateFiles())
|
||||
|
||||
omod.ExtractFilesParallel((string) dest.Dir, 4);
|
||||
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 path = file.RelativeTo(dest.Dir);
|
||||
if (!shouldExtract(path)) continue;
|
||||
var abs = compressedFile.Name.RelativeTo(dest.Dir);
|
||||
var rel = abs.RelativeTo(dest.Dir);
|
||||
if (!shouldExtract(rel)) continue;
|
||||
|
||||
var result = await mapfn(path, new ExtractedNativeFile(file));
|
||||
results.Add(path, result);
|
||||
var result = await mapfn(rel, new ExtractedNativeFile(abs));
|
||||
results.Add(rel, result);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
var archive = await BSADispatch.OpenRead(sFn, sig);
|
||||
|
@ -16,7 +16,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Genbox.AlphaFS" Version="2.2.2.1" />
|
||||
<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="System.Collections.Immutable" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user