31 lines
887 B
C#
31 lines
887 B
C#
using System.Text.Json;
|
|
using System.IO;
|
|
|
|
namespace CodeMerger.Models;
|
|
|
|
public class AppSettings
|
|
{
|
|
private const string CONFIG_FILE = "appsettings.json";
|
|
private static string ConfigPath => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CONFIG_FILE);
|
|
|
|
public string? LastOriginalFilePath { get; set; }
|
|
public string? LastLLMFilePath { get; set; }
|
|
public string? LastOutputFilePath { get; set; }
|
|
|
|
public static AppSettings Load()
|
|
{
|
|
if (File.Exists(ConfigPath))
|
|
{
|
|
var json = File.ReadAllText(ConfigPath);
|
|
return JsonSerializer.Deserialize<AppSettings>(json) ?? new AppSettings();
|
|
}
|
|
return new AppSettings();
|
|
}
|
|
|
|
public void Save()
|
|
{
|
|
var json = JsonSerializer.Serialize(this, new JsonSerializerOptions { WriteIndented = true });
|
|
File.WriteAllText(ConfigPath, json);
|
|
}
|
|
}
|