SysParam.cs 996 Bytes
using Newtonsoft.Json;
using System.IO;

namespace FLY.Integrated.Server
{
    public class SysParam
    {
        /// <summary>
        /// OBJ服务端口
        /// </summary>
        public int OBJ_Port { get; set; } = 20003;

        /// <summary>
        /// 数据库保持时间 默认6个月
        /// </summary>
        public int DBKeepMonth { get; set; } = 6;

        public SysParam()
        {
            Load();
        }
        public void Save()
        {
            string json = JsonConvert.SerializeObject(this, Formatting.Indented);
            File.WriteAllText("system.json", json);
        }
        public void Load()
        {
            if (File.Exists("system.json"))
            {
                try
                {
                    string json = File.ReadAllText("system.json");
                    JsonConvert.PopulateObject(json, this);
                }
                catch
                {

                }
            }
        }

    }
}