Skip to content

Commit

Permalink
Handle PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
halgari committed Oct 7, 2024
1 parent 11c31c0 commit 6444ae4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/NexusMods.Collections/InstallCollectionJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ await Parallel.ForEachAsync(archive.Children, async (child, token) =>

// If we have any binary patching to do, then we'll do that now.
if (file.Mod.Patches.Any())
await CreatePatches(file.Mod, archive, collectionArchive, hashes);
await PatchFiles(file.Mod, archive, collectionArchive, hashes);

using var tx = Connection.BeginTransaction();

Expand Down Expand Up @@ -269,7 +269,7 @@ await Parallel.ForEachAsync(archive.Children, async (child, token) =>
/// <summary>
/// This will go through and generate all the patch files for the given archive based on the mod's patches.
/// </summary>
private async Task CreatePatches(Mod modInfo, LibraryArchive.ReadOnly modArchive, LibraryArchive.ReadOnly collectionArchive,
private async Task PatchFiles(Mod modInfo, LibraryArchive.ReadOnly modArchive, LibraryArchive.ReadOnly collectionArchive,
ConcurrentDictionary<Md5HashValue, HashMapping> hashes)
{
// Index all the files in the collection zip file and the mod archive by their paths so we can find them easily.
Expand Down
11 changes: 9 additions & 2 deletions src/NexusMods.Collections/Verbs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ internal static class Verbs
{
internal static IServiceCollection AddCollectionVerbs(this IServiceCollection collection) =>
collection
.AddVerb(() => InstallCollection)
.AddVerb(() => GatherCollectionDefinitions);
#if DEBUG
.AddVerb(() => GatherCollectionDefinitions)
#endif
.AddVerb(() => InstallCollection);


[Verb("install-collection", "Installs a collection into the given loadout")]
Expand Down Expand Up @@ -49,6 +51,11 @@ private static async Task<int> InstallCollection([Injected] IRenderer renderer,
return 0;
}

/// <summary>
/// This verb is only available in DEBUG builds, and is used to get large numbers of collection.json files. The code exists here incase we need
/// this behavior again in the future. Disabled in release builds to prevent people from running it without knowing what it does.
/// </summary>
/// <returns></returns>
[Verb("gather-collection-definitions", "Downloads all the collection definitions for a given game, and extracts them to a folder")]
private static async Task<int> GatherCollectionDefinitions([Injected] IRenderer renderer,
[Option("g", "game", "Game to gather collection definitions for")] IGame game,
Expand Down

0 comments on commit 6444ae4

Please sign in to comment.