mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-22 00:04:57 +01:00
Add settings profiles and expand exposed eu07.ini options
Adds save/apply named settings profiles (SettingsProfileStore), a battery-default export option that rewrites trainset velocity on launch, and an option to omit decorative trainsets from the exported scenery. Also surfaces many previously-unmapped eu07.ini keys in the Settings UI (UART/feedback port, FPS limit, shadow angle, fullscreen windowed, ANGLE Vulkan, friction/brake sensitivity, and an Advanced section for texture/GLES/threading tunables).
This commit is contained in:
@@ -125,6 +125,28 @@ public sealed class ConfigFile
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates <paramref name="key"/> by turning its line into a comment,
|
||||
/// preserving indentation, the key/value that was there and any trailing
|
||||
/// comment. No-op if the key is not currently active.
|
||||
/// </summary>
|
||||
public void Remove(string key)
|
||||
{
|
||||
if (!_index.TryGetValue(key, out int i))
|
||||
return;
|
||||
|
||||
SplitLine(_lines[i], out string indent, out _, out string value, out string comment);
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(indent).Append("// ").Append(key);
|
||||
if (value.Length > 0)
|
||||
sb.Append(' ').Append(value);
|
||||
if (comment.Length > 0)
|
||||
sb.Append('\t').Append(comment);
|
||||
_lines[i] = sb.ToString();
|
||||
|
||||
_index.Remove(key);
|
||||
}
|
||||
|
||||
public void SetBool(string key, bool value) => Set(key, value ? "yes" : "no");
|
||||
public void SetInt(string key, int value) =>
|
||||
Set(key, value.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
Reference in New Issue
Block a user