support for .NET framework 3.5
Still have bugs
This commit is contained in:
1 parent
5878039e21
commit
7d6b491f25
704 files changed
+48273
-33
No files matched your search
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace HandyControlDemo.Data
|
||||
{
|
||||
internal class GlobalData
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
if (File.Exists(AppConfig.SavePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
var json = File.ReadAllText(AppConfig.SavePath);
|
||||
Config = JsonConvert.DeserializeObject<AppConfig>(json);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Config = new AppConfig();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Config = new AppConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Save()
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(Config);
|
||||
File.WriteAllText(AppConfig.SavePath, json);
|
||||
}
|
||||
|
||||
public static AppConfig Config { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user