43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Text.Json;
|
|
|
|
namespace sharpFRN
|
|
{
|
|
public class Settings
|
|
{
|
|
public string WebSocketHost { get; set; }
|
|
public FRNSettings FRNClient { get; set; }
|
|
}
|
|
|
|
public class FRNSettings
|
|
{
|
|
public string Host { get; set; }
|
|
public int Port { get; set; }
|
|
public string CallSign { get; set; }
|
|
public string Name { get; set; }
|
|
public string Email { get; set; }
|
|
public string Password { get; set; }
|
|
public string Network { get; set; }
|
|
public string Country { get; set; }
|
|
public string City { get; set; }
|
|
public string Locator { get; set; }
|
|
public string Type { get; set; }
|
|
public string Description { get; set; }
|
|
}
|
|
|
|
public static class SettingsLoader
|
|
{
|
|
public static Settings Load(string filePath)
|
|
{
|
|
if (!File.Exists(filePath))
|
|
{
|
|
throw new FileNotFoundException($"Settings file not found: {filePath}");
|
|
}
|
|
|
|
string json = File.ReadAllText(filePath);
|
|
return JsonSerializer.Deserialize<Settings>(json);
|
|
}
|
|
}
|
|
}
|