mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-17 23:10:30 +00:00
Starts looking good
This commit is contained in:
30
ConfigGenerator/ASFConfig.cs
Normal file
30
ConfigGenerator/ASFConfig.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace ConfigGenerator {
|
||||
internal class ASFConfig {
|
||||
internal static List<ASFConfig> ASFConfigs = new List<ASFConfig>();
|
||||
|
||||
internal string FilePath { get; set; }
|
||||
|
||||
protected ASFConfig() {
|
||||
ASFConfigs.Add(this);
|
||||
}
|
||||
|
||||
protected ASFConfig(string filePath) : base() {
|
||||
FilePath = filePath;
|
||||
}
|
||||
|
||||
internal virtual void Save() {
|
||||
lock (FilePath) {
|
||||
try {
|
||||
File.WriteAllText(FilePath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user