40 lines
977 B
C#
40 lines
977 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Tomlyn;
|
|
|
|
namespace FiddlerDecryption.Utils
|
|
{
|
|
internal class Setting
|
|
{
|
|
public static string DEFAULT_API_HOST = "http://localhost:7788";
|
|
public string ApiHost { get; set; } = DEFAULT_API_HOST;
|
|
public static Setting Instance
|
|
{
|
|
get
|
|
{
|
|
Setting setting;
|
|
try
|
|
{
|
|
setting = Toml.ToModel<Setting>(File.ReadAllText("emoney.toml"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
setting = new Setting();
|
|
setting.Save();
|
|
}
|
|
return setting;
|
|
}
|
|
}
|
|
|
|
public void Save()
|
|
{
|
|
string toml = Toml.FromModel(this);
|
|
File.WriteAllText("emoney.toml", toml);
|
|
}
|
|
}
|
|
}
|