mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Re-added SteamWorkshop items, changed ReportBuilder to include those items
This commit is contained in:
parent
758df21d91
commit
f6d51b4e33
@ -64,8 +64,12 @@ namespace Wabbajack.Lib
|
|||||||
.Do(NoWrapText);
|
.Do(NoWrapText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var archiveCount = lst.Archives.Count + lst.Directives.Count(d => d is SteamMeta);
|
||||||
|
var totalSize = lst.Archives.Sum(a => a.Size);
|
||||||
|
totalSize += lst.Directives.Where(d => d is SteamMeta).Cast<SteamMeta>().Sum(s => s.Size);
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
$"#### Download Summary ({lst.Archives.Count} archives - {lst.Archives.Sum(a => a.Size).ToFileSizeString()})");
|
$"#### Download Summary ({archiveCount} archives - {totalSize.ToFileSizeString()})");
|
||||||
foreach (var archive in SortArchives(lst.Archives))
|
foreach (var archive in SortArchives(lst.Archives))
|
||||||
{
|
{
|
||||||
var hash = archive.Hash.FromBase64().ToHex();
|
var hash = archive.Hash.FromBase64().ToHex();
|
||||||
@ -78,7 +82,8 @@ namespace Wabbajack.Lib
|
|||||||
if (f is SteamMeta s)
|
if (f is SteamMeta s)
|
||||||
{
|
{
|
||||||
var link = $"https://steamcommunity.com/sharedfiles/filedetails/?id={s.ItemID}";
|
var link = $"https://steamcommunity.com/sharedfiles/filedetails/?id={s.ItemID}";
|
||||||
NoWrapText($"* Steam Workshop Item: [{s.ItemID}]({link}) | Size: {s.Size}");
|
var size = ((long)s.Size).ToFileSizeString();
|
||||||
|
NoWrapText($"* Steam Workshop Item: [{s.ItemID}]({link}) | Size: {size}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -46,6 +46,10 @@ namespace Wabbajack.Lib
|
|||||||
public const string StagingMarkerName = "__vortex_staging_folder";
|
public const string StagingMarkerName = "__vortex_staging_folder";
|
||||||
public const string DownloadMarkerName = "__vortex_downloads_folder";
|
public const string DownloadMarkerName = "__vortex_downloads_folder";
|
||||||
|
|
||||||
|
private bool _isSteamGame;
|
||||||
|
private SteamGame _steamGame;
|
||||||
|
private bool _hasSteamWorkshopItems;
|
||||||
|
|
||||||
public VortexCompiler(Game game, string gamePath, string vortexFolder, string downloadsFolder,
|
public VortexCompiler(Game game, string gamePath, string vortexFolder, string downloadsFolder,
|
||||||
string stagingFolder, string outputFile)
|
string stagingFolder, string outputFile)
|
||||||
{
|
{
|
||||||
@ -65,6 +69,14 @@ namespace Wabbajack.Lib
|
|||||||
GameName = Game.MetaData().NexusName;
|
GameName = Game.MetaData().NexusName;
|
||||||
|
|
||||||
ActiveArchives = new List<string>();
|
ActiveArchives = new List<string>();
|
||||||
|
|
||||||
|
SteamHandler.Instance.Games.Where(g => g.Game != null && g.Game == game).Do(g =>
|
||||||
|
{
|
||||||
|
_isSteamGame = true;
|
||||||
|
_steamGame = g;
|
||||||
|
SteamHandler.Instance.LoadWorkshopItems(_steamGame);
|
||||||
|
_hasSteamWorkshopItems = _steamGame.WorkshopItems.Count > 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task<bool> _Begin(CancellationToken cancel)
|
protected override async Task<bool> _Begin(CancellationToken cancel)
|
||||||
@ -162,7 +174,7 @@ namespace Wabbajack.Lib
|
|||||||
if (cancel.IsCancellationRequested) return false;
|
if (cancel.IsCancellationRequested) return false;
|
||||||
var stack = MakeStack();
|
var stack = MakeStack();
|
||||||
UpdateTracker.NextStep("Running Compilation Stack");
|
UpdateTracker.NextStep("Running Compilation Stack");
|
||||||
var results = await AllFiles.PMap(Queue, UpdateTracker, f => RunStack(stack, f));
|
var results = await AllFiles.PMap(Queue, f => RunStack(stack.Where(s => s != null), f));
|
||||||
|
|
||||||
IEnumerable<NoMatch> noMatch = results.OfType<NoMatch>().ToList();
|
IEnumerable<NoMatch> noMatch = results.OfType<NoMatch>().ToList();
|
||||||
Info($"No match for {noMatch.Count()} files");
|
Info($"No match for {noMatch.Count()} files");
|
||||||
@ -331,6 +343,36 @@ namespace Wabbajack.Lib
|
|||||||
Error("Error while getting information from NexusMods via MD5 hash!");
|
Error("Error while getting information from NexusMods via MD5 hash!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Info($"Checking for Steam Workshop Items...");
|
||||||
|
if (!_isSteamGame || _steamGame == null || !_hasSteamWorkshopItems)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_steamGame.WorkshopItems.Do(item =>
|
||||||
|
{
|
||||||
|
var filePath = Path.Combine(DownloadsFolder, $"steamWorkshopItem_{item.ItemID}.meta");
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
Utils.Log($"File {filePath} already exists, skipping...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Utils.Log($"Creating meta file for {item.ItemID}");
|
||||||
|
var metaString = "[General]\n" +
|
||||||
|
"repository=Steam\n" +
|
||||||
|
$"gameName={GameName}\n" +
|
||||||
|
$"steamID={_steamGame.AppId}\n" +
|
||||||
|
$"itemID={item.ItemID}\n" +
|
||||||
|
$"itemSize={item.Size}\n";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.WriteAllText(filePath, metaString);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Utils.Error(e, $"Exception while writing to disk at {filePath}");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<ICompilationStep> GetStack()
|
public override IEnumerable<ICompilationStep> GetStack()
|
||||||
@ -354,6 +396,10 @@ namespace Wabbajack.Lib
|
|||||||
return new List<ICompilationStep>
|
return new List<ICompilationStep>
|
||||||
{
|
{
|
||||||
new IncludePropertyFiles(this),
|
new IncludePropertyFiles(this),
|
||||||
|
|
||||||
|
new IncludeSteamWorkshopItems(this, _steamGame),
|
||||||
|
_hasSteamWorkshopItems ? new IncludeRegex(this, "^steamWorkshopItem_\\d*\\.meta$") : null,
|
||||||
|
|
||||||
new IgnoreDisabledVortexMods(this),
|
new IgnoreDisabledVortexMods(this),
|
||||||
new IncludeVortexDeployment(this),
|
new IncludeVortexDeployment(this),
|
||||||
new IgnoreVortex(this),
|
new IgnoreVortex(this),
|
||||||
|
Loading…
Reference in New Issue
Block a user