Skip to content

Commit f074c1c

Browse files
committed
wip
1 parent c561875 commit f074c1c

6 files changed

Lines changed: 20 additions & 19 deletions

File tree

Stalker.Gamma/GammaInstallerServices/GammaInstaller/GammaInstaller.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ GammaInstallerArgs args
5353
args.Gamma,
5454
rec,
5555
out var dlRec,
56-
useCurl: !(args.ExperimentalPythonServerSettings?.Enabled ?? false)
56+
useCurl: !args.UseExperimentalPythonServer
5757
)
5858
)
5959
{
@@ -109,7 +109,10 @@ public void BuildSpecialRepoRecords(GammaInstallerArgs args)
109109
public virtual async Task InstallAsync(GammaInstallerArgs args)
110110
{
111111
Task? pythonServerStartTask = null;
112-
if (args.ExperimentalPythonServerSettings?.Enabled is true)
112+
if (
113+
args is
114+
{ UseExperimentalPythonServer: true, ExperimentalPythonServerSettings: not null }
115+
)
113116
{
114117
pythonServerStartTask = pythonServerService.StartAsync(
115118
args.ExperimentalPythonServerSettings.Host,
@@ -224,10 +227,7 @@ await PreserveUserLtxSettingsService.ReadUserLtxAsync(
224227
args.CancellationToken
225228
);
226229

227-
if (
228-
args.ExperimentalPythonServerSettings?.Enabled is true
229-
&& pythonServerStartTask is not null
230-
)
230+
if (args.UseExperimentalPythonServer && pythonServerStartTask is not null)
231231
{
232232
await pythonServerStartTask;
233233
}
@@ -394,7 +394,7 @@ public IDownloadableRecord BuildAnomalyRecord(GammaInstallerArgs args)
394394
var anomalyRecord = downloadableRecordFactory.CreateAnomalyRecord(
395395
Path.Join(args.Gamma, "downloads"),
396396
args.Anomaly,
397-
useCurl: !(args.ExperimentalPythonServerSettings?.Enabled ?? false)
397+
useCurl: !args.UseExperimentalPythonServer
398398
);
399399
return args.SkipExtractOnHashMatch
400400
? downloadableRecordFactory.CreateSkipExtractWhenNotDownloadedRecord(anomalyRecord)

Stalker.Gamma/GammaInstallerServices/GammaInstaller/GammaInstallerArgs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class GammaInstallerArgs
1616
public bool Offline { get; set; }
1717
public bool PreserveUserLtx { get; set; }
1818
public bool PreserveMcmSettings { get; set; }
19+
public bool UseExperimentalPythonServer { get; set; }
1920
public ExperimentalPythonServerSettings? ExperimentalPythonServerSettings { get; set; }
2021
public string? ModPackMakerPath { get; set; }
2122
public string? ModListPath { get; set; }

Stalker.Gamma/GammaInstallerServices/GammaInstaller/GammaInstallerArgsBuilder.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class GammaInstallerArgsBuilder(string anomaly, string gamma, string cach
1616
private bool _preserveMcmSettings;
1717
private string? _modPackMakerPath;
1818
private string? _modListPath;
19+
private bool _useExperimentalPythonServer;
1920
private ExperimentalPythonServerSettings? _experimentalPythonServerSettings;
2021

2122
public GammaInstallerArgsBuilder WithCancellationToken(CancellationToken ct)
@@ -66,6 +67,12 @@ public GammaInstallerArgsBuilder WithPreserveMcmSettings(bool value = true)
6667
return this;
6768
}
6869

70+
public GammaInstallerArgsBuilder WithUseExperimentalPythonServer(bool value = false)
71+
{
72+
_useExperimentalPythonServer = value;
73+
return this;
74+
}
75+
6976
public GammaInstallerArgsBuilder WithExperimentalPythonServerSettings(
7077
ExperimentalPythonServerSettings? value
7178
)
@@ -116,6 +123,7 @@ public GammaInstallerArgs Build() =>
116123
ModListPath = _modListPath,
117124
GroupedAddonRecords = _groupedAddonRecords,
118125
AnomalyRecord = _anomalyRecord,
126+
UseExperimentalPythonServer = _useExperimentalPythonServer,
119127
ExperimentalPythonServerSettings = _experimentalPythonServerSettings,
120128
};
121129
}

Stalker.Gamma/Models/ExperimentalPythonServerSettings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ namespace Stalker.Gamma.Models;
22

33
public class ExperimentalPythonServerSettings
44
{
5-
public bool Enabled { get; set; }
65
public required string Host { get; set; }
76
public ushort Port { get; set; }
87
}

stalker-gamma-cli/Commands/FullInstall.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ ProgressLoggingService progressLoggingService
3737
/// <param name="offline">Perform an offline installation from a cache. This will not download anything if you combine this with --mod-pack-maker-path and --mod-list-path</param>
3838
/// <param name="preserveUserSettings">Preserve user settings (user.ltx)</param>
3939
/// <param name="preserveMcmSettings">Preserve MCM settings</param>
40+
/// <param name="experimentalPythonServer">Use experimental python server when contacting moddb</param>
4041
/// <param name="modPackMakerPath">Path to modpack_maker_list.txt. Offline install.</param>
4142
/// <param name="modListPath">Path to modlist.txt. Offline install.</param>
4243
/// <param name="downloadThreads">Override downloadThreads defined in your profile</param>
@@ -53,6 +54,7 @@ public async Task<int> FullInstall(
5354
bool offline = false,
5455
bool preserveUserSettings = false,
5556
bool preserveMcmSettings = false,
57+
bool experimentalPythonServer = false,
5658
string? modPackMakerPath = null,
5759
string? modListPath = null,
5860
[Range(1, 20)] int? downloadThreads = null,
@@ -116,6 +118,7 @@ out var gammaDbgDispo
116118
.WithModListPath(modListPath)
117119
.WithPreserveUserLtx(preserveUserSettings)
118120
.WithPreserveMcmSettings(preserveMcmSettings)
121+
.WithUseExperimentalPythonServer(experimentalPythonServer)
119122
.WithExperimentalPythonServerSettings(
120123
_cliSettings.ExperimentalModDbSettings.ToServerSettings()
121124
)

stalker-gamma-cli/Models/ExperimentalModDbSettings.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ public partial class ExperimentalModDbSettingsCtx : JsonSerializerContext;
88

99
public class ExperimentalModDbSettings
1010
{
11-
public bool ExperimentalModDbLogicEnabled { get; set; } = false;
1211
public string Host { get; set; } = "127.0.0.1";
1312
public ushort Port { get; set; } = 8000;
1413

@@ -17,10 +16,6 @@ public bool TrySet(string setting, string value, out string? error)
1716
error = null;
1817
switch (setting.ToLowerInvariant())
1918
{
20-
case "experimentalmoddblogicenabled":
21-
ExperimentalModDbLogicEnabled = bool.Parse(value);
22-
return true;
23-
2419
case "host":
2520
Host = value;
2621
return true;
@@ -42,10 +37,5 @@ public bool TrySet(string setting, string value, out string? error)
4237
}
4338

4439
public ExperimentalPythonServerSettings ToServerSettings() =>
45-
new()
46-
{
47-
Enabled = ExperimentalModDbLogicEnabled,
48-
Host = Host,
49-
Port = Port,
50-
};
40+
new() { Host = Host, Port = Port };
5141
}

0 commit comments

Comments
 (0)