Initial commit: IBKRTrader

.NET WinForms-Anwendung (Core, Modules/CongressTrading, UI).
Enthaelt .gitignore und settings.example.json als Konfigurationsvorlage.
Echte settings.json mit Zugangsdaten ist bewusst ausgeschlossen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-07-26 18:19:47 +02:00
co-authored by Claude Opus 4.8
commit ebeb035e92
47 changed files with 4527 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace IBKRTrader.Core.Settings;
/// <summary>
/// Lädt und speichert settings.json neben der EXE.
/// Singleton wird beim App-Start einmalig geladen.
/// </summary>
public class SettingsService
{
private static readonly string SettingsPath =
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "settings.json");
private static readonly JsonSerializerOptions JsonOptions = new()
{
WriteIndented = true,
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
PropertyNameCaseInsensitive = true
};
public AppSettings Settings { get; private set; } = new();
public void Load()
{
if (!File.Exists(SettingsPath))
{
Save(); // Defaults auf Disk schreiben
return;
}
try
{
var json = File.ReadAllText(SettingsPath);
Settings = JsonSerializer.Deserialize<AppSettings>(json, JsonOptions) ?? new AppSettings();
}
catch
{
Settings = new AppSettings();
Save();
}
}
public void Save()
{
var json = JsonSerializer.Serialize(Settings, JsonOptions);
File.WriteAllText(SettingsPath, json);
}
}