start a big rework
This commit is contained in:
@@ -1,25 +1,26 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Pilz.Updating.Administration.Discord;
|
||||
using Pilz.Updating.Administration.Integrations;
|
||||
using System.IO;
|
||||
|
||||
namespace Pilz.Updating.Administration;
|
||||
|
||||
public class UpdateProject
|
||||
{
|
||||
public UpdateServerConfig UpdateServerConfig { get; } = new UpdateServerConfig();
|
||||
public DiscordBotConfig DiscordBotConfig { get; } = new DiscordBotConfig();
|
||||
public ProxyConfiguration ProxyConfig { get; } = new ProxyConfiguration();
|
||||
public UpdateServerConfig UpdateServerConfig { get; } = new();
|
||||
public DiscordBotConfig DiscordBotConfig { get; } = new();
|
||||
public ProxyConfiguration ProxyConfig { get; } = new();
|
||||
|
||||
public static UpdateProject Load(string filePath)
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
return JObject.Parse(File.ReadAllText(filePath)).ToObject<UpdateProject>();
|
||||
return JsonConvert.DeserializeObject<UpdateProject>(File.ReadAllText(filePath));
|
||||
else
|
||||
return new UpdateProject();
|
||||
return new();
|
||||
}
|
||||
|
||||
public void Save(string filePath)
|
||||
{
|
||||
File.WriteAllText(filePath, JObject.FromObject(this).ToString());
|
||||
File.WriteAllText(filePath, JsonConvert.SerializeObject(this));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user