Skip to content

Commit a1b5af0

Browse files
committed
add --minimal switch to full-install
1 parent c4a5a7d commit a1b5af0

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

Stalker.Gamma/GammaInstallerServices/GammaInstaller.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class GammaInstallerArgs
2020
public bool SkipExtractOnHashMatch { get; set; }
2121
public CancellationToken CancellationToken { get; set; } = CancellationToken.None;
2222
public string Mo2Profile { get; set; } = "G.A.M.M.A";
23+
public bool Minimal { get; set; }
2324
}
2425

2526
public class InstallUpdatesArgs
@@ -153,6 +154,8 @@ public virtual async Task FullInstallAsync(GammaInstallerArgs args)
153154
await ProcessAddonsAsync(
154155
[anomalyRecord, .. groupedAddonRecords],
155156
brokenAddons,
157+
args.Minimal,
158+
cancellationToken:
156159
args.CancellationToken
157160
),
158161
args.CancellationToken
@@ -319,7 +322,7 @@ await File.ReadAllTextAsync(
319322

320323
var mainBatch = Task.Run(
321324
async () =>
322-
await ProcessAddonsAsync(groupedAddonRecords, brokenAddons, args.CancellationToken),
325+
await ProcessAddonsAsync(groupedAddonRecords, brokenAddons, cancellationToken: args.CancellationToken),
323326
args.CancellationToken
324327
);
325328
var teivazDlTask = Task.Run(
@@ -414,6 +417,7 @@ await File.WriteAllTextAsync(
414417
private async Task ProcessAddonsAsync(
415418
IList<IDownloadableRecord> addons,
416419
ConcurrentBag<IDownloadableRecord> brokenAddons,
420+
bool minimal = false,
417421
CancellationToken cancellationToken = default
418422
) =>
419423
await Parallel.ForEachAsync(
@@ -425,6 +429,10 @@ await Parallel.ForEachAsync(
425429
{
426430
await grs.DownloadAsync(cancellationToken);
427431
await grs.ExtractAsync(cancellationToken);
432+
if (minimal)
433+
{
434+
grs.DeleteArchive();
435+
}
428436
}
429437
catch (Exception)
430438
{

Stalker.Gamma/Models/IDownloadableRecord.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@ public interface IDownloadableRecord
88
public Task DownloadAsync(CancellationToken cancellationToken);
99
public Task ExtractAsync(CancellationToken cancellationToken);
1010
public bool Downloaded { get; }
11+
12+
public void DeleteArchive()
13+
{
14+
if (File.Exists(DownloadPath))
15+
{
16+
File.Delete(DownloadPath);
17+
}
18+
}
1119
}

stalker-gamma-cli/Commands/FullInstall.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ UtilitiesReady utilitiesReady
2727
/// <param name="addFoldersToWinDefenderExclusion">(Windows) Add the anomaly, gamma, and cache folders to the Windows Defender Exclusion list</param>
2828
/// <param name="enableLongPaths">(Windows) Enable long paths</param>
2929
/// <param name="verbose">More verbose logging</param>
30+
/// <param name="minimal">Delete cache files after extracting</param>
3031
/// <param name="debug"></param>
3132
/// <param name="mo2Version">The version of Mod Organizer 2 to download</param>
3233
/// <param name="progressUpdateIntervalMs">How frequently to write progress to the console in milliseconds</param>
@@ -44,6 +45,7 @@ public async Task FullInstall(
4445
bool addFoldersToWinDefenderExclusion = false,
4546
bool enableLongPaths = false,
4647
bool verbose = false,
48+
bool minimal = false,
4749
[Hidden] bool debug = false,
4850
[Hidden] string? mo2Version = null,
4951
[Hidden] long progressUpdateIntervalMs = 250,
@@ -137,6 +139,7 @@ await gammaInstaller.FullInstallAsync(
137139
DownloadGithubArchives = !skipGithubDownloads,
138140
SkipExtractOnHashMatch = skipExtractOnHashMatch,
139141
Mo2Profile = mo2Profile,
142+
Minimal = minimal
140143
}
141144
);
142145
_logger.Information("Install finished");

0 commit comments

Comments
 (0)