first commit
This commit is contained in:
39
FiddlerDecryption/Utils/Setting.cs
Normal file
39
FiddlerDecryption/Utils/Setting.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user