-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettings.cs
More file actions
31 lines (25 loc) · 857 Bytes
/
Settings.cs
File metadata and controls
31 lines (25 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Text.Json;
namespace EyePatch
{
public class Settings
{
public string? DiffApp { get; set; }
public string? PatchDirectory { get; init; }
private static readonly string SettingsFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".eyepatch.settings");
public static Settings Load()
{
Settings settings;
if (File.Exists(SettingsFilePath))
{
var json = File.ReadAllText(SettingsFilePath);
settings = JsonSerializer.Deserialize<Settings>(json) ?? new Settings();
}
else
{
settings = new Settings();
}
settings.DiffApp ??= "windiff";
return settings;
}
}
}