using CatLib;
using Highway.Assemble.common;
using Highway.Assemble.EquipClient;
using Highway.Assemble.Sql;
using Highway.SocketServer;

namespace HighWayAssemble
{

    public partial class Program
    {
        /// <summary>
        /// 框架初始化
        /// </summary>
        public static void FramworkInit()
        {
            var application = CatLib.Application.New();
            application.Bootstrap();
            application.Register(new ProviderSystem());
            application.Init();
        }
    }
    public class ProviderSystem : CatLib.IServiceProvider
    {
        /// <summary>
        /// 初始化加载
        /// </summary>
        public void Init() { Program.Start(); }
        /// <summary>
        /// 系统注册实例绑定
        /// </summary>
        public void Register()
        {   //SocketServer单例绑定
            App.Singleton<IAsyncSocketServer, AsyncSocketServer>();
            //配置信息
            //  App.Singleton < IConfigInfo, ConfigInfo > ();
            //绑定 信息表
            App.Singleton<ISoftInfo, SoftInfo>();
            App.Singleton<IEquipClient, EquipClient>();
            App.Singleton<IBoxDB, BoxDB>();
            //实例绑定
            App.Bind<ISql, DbHandler>();
        }


        ~ProviderSystem()
        {
            App.Terminate();
        }

    }

}
