using ChuPiao.Common.Utils;
using log4net;
using ChuPiao.Common.Communication.GtdJson.Configuration;

namespace ChuPiao.Common.Communication.GtdJson
{
    public class PackSetting
    {
        /// <summary>
        /// 配置实例
        /// </summary>
        public static PackSetting Instance = new PackSetting();

        public PackSetting()
        {

        }
        /// <summary>
        /// 从配置文件加载配置
        /// </summary>
        public void Configure()
        {
            GtdpackSettingElement gtdPackSetting = GtdpackConfigurationSection.GetGtdpackConfigurationSection().GtdpackSetting;
            Url = gtdPackSetting.Url;
            Log = LogUtil.CreateLoggerByName(gtdPackSetting.Logger);
            TimeOut = gtdPackSetting.TimeOut;
        }


        #region 属性

        /// <summary>
        /// 主机
        /// </summary>
        public string Url
        {
            get { return _url; }
            set { _url = value; }
        }

        /// <summary>
        /// 日志记录器
        /// </summary>
        public ILog Log
        {
            get { return _log; }
            set { _log = value; }
        }
       
        /// <summary>
        /// 超时时间
        /// </summary>
        public int TimeOut
        {
            get { return _timeOut; }
            set { _timeOut = value; }
        }
 
        private string _url;
        private ILog _log;
        private int _timeOut = 10000;//10秒

        #endregion
    }
}
