using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Weight2.Server
{
public class SysParam
{
///
/// OBJ服务端口
///
public int OBJ_Port { get; set; } = 20005;
///
/// 远程服务器
///
public string BlowingAddr { get; set; } = "127.0.0.1:20006";
///
/// 数据库保持时间 默认6个月
///
public int DBKeepMonth { get; set; } = 6;
public SysParam()
{
if (!Load()) {
Save();
}
}
public void Save()
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
File.WriteAllText("system.json", json);
}
public bool Load()
{
if (!File.Exists("system.json"))
{
return false;
}
try
{
string json = File.ReadAllText("system.json");
Newtonsoft.Json.JsonConvert.PopulateObject(json, this);
return true;
}
catch {
}
return false;
}
}
}