mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-21 23:37:44 +01:00
chore: clean up config to not require paths
This commit is contained in:
parent
aaf271886c
commit
4f92d5c79e
3 changed files with 18 additions and 9 deletions
|
|
@ -31,12 +31,21 @@ namespace Dalamud
|
|||
|
||||
public string LastVersion { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string ConfigPath;
|
||||
|
||||
public static DalamudConfiguration Load(string path) {
|
||||
return JsonConvert.DeserializeObject<DalamudConfiguration>(File.ReadAllText(path));
|
||||
var deserialized = JsonConvert.DeserializeObject<DalamudConfiguration>(File.ReadAllText(path));
|
||||
deserialized.ConfigPath = path;
|
||||
|
||||
return deserialized;
|
||||
}
|
||||
|
||||
public void Save(string path) {
|
||||
File.WriteAllText(path, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
/// <summary>
|
||||
/// Save the configuration at the path it was loaded from.
|
||||
/// </summary>
|
||||
public void Save() {
|
||||
File.WriteAllText(this.ConfigPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue