using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Misc;
using System.Net;
using System.IO;
using System.ComponentModel;
using System.Xml.Serialization;
using FLY.Thick.Base.Common;

namespace FLY.Thick.Base.Server
{
    //代替TDInitParam
    public class SysParam : INotifyPropertyChanged, ISaveToXml
    {
        #region 属性，成员变量的代理

        /// <summary>
        /// 本机obj服务地址
        /// </summary>
        [PropertyChanged.DoNotCheckEquality]
        public IPEndPoint LocalEP { get; set; } = Misc.StringConverter.ToIPEndPoint("127.0.0.1:20006");

        #endregion

        private string param_path = "sysparam.xml";
        public SysParam()
        {

        }
        public SysParam(string param_path) 
        {
            if (!string.IsNullOrEmpty(param_path))
                this.param_path = param_path;
            Load();
        }


        public bool Load()
        {
            bool ret = Misc.SaveToXmlHepler.Load(param_path, this);
            return ret;
        }


        #region INotifyPropertyChanged 成员

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        public string[] GetSavePropertyNames()
        {
            return new string[]{
            "LocalEP"
            };
        }
    }
}
