Exemple #1
0
    //-------------------------------------------------------------------------
    static void Main(string[] args)
    {
        Console.Title = "EsTest";

        EsEngineSettings settings;
        settings.NodeType = 2;
        settings.NodeTypeString = "EsTest";
        settings.ListenIp = "127.0.0.1";
        settings.ListenPort = 5882;
        settings.RootEntityType = "EtNode";
        settings.EnableCoSupersocket = false;
        settings.Log4NetConfigPath = "../../../Media/EsTest/EsTest.log4net.config";

        EsEngine e = new EsEngine(ref settings, new EsEngineListener());
        e.run();
    }
Exemple #2
0
        //---------------------------------------------------------------------
        public EsEngine(ref EsEngineSettings settings, IEsEngineListener listener)
        {
            mInstance = this;
            mListener = listener;
            Settings  = settings;

            // 日志设置
            //{
            //    ILogFactory log_factory = new Log4NetLogFactory(settings.Log4NetConfigPath);
            //    EbLogFactory.SetLogFactory(log_factory);
            //    mLog = EbLogFactory.GetLog(this.GetType().Name);

            //    EbLog.NoteCallback = mLog.Info;
            //    EbLog.WarningCallback = mLog.Warn;
            //    EbLog.ErrorCallback = mLog.Error;
            //}

            // 处理未捕获的异常
            AppDomain.CurrentDomain.UnhandledException +=
                new UnhandledExceptionEventHandler(_unhandledExceptionEventHandler);

            EbLog.Note("-----------EsEngine启动开始--------------");

            // EntityMgr初始化
            mEntityMgr = new EntityMgr(Settings.NodeType, Settings.NodeTypeString);

            mEntityMgr.regComponent <ServerNode <DefNode> >();
            mEntityMgr.regComponent <ServerSuperSocket <DefSuperSocket> >();

            mEntityMgr.regEntityDef <EtNode>();
            mEntityMgr.regEntityDef <EtSuperSocket>();

            EtNode = mEntityMgr.createEntity <EtNode>(null, null);
            var co_node = EtNode.getComponent <ServerNode <DefNode> >();

            CoSuperSocket = co_node.CoSuperSocket;

            EbLog.Note("-----------EsEngine启动完毕--------------");

            // 通知业务层初始化
            if (mListener != null)
            {
                mListener.init(mEntityMgr, EtNode);
            }
        }
Exemple #3
0
        //---------------------------------------------------------------------
        public EsEngine(ref EsEngineSettings settings, IEsEngineListener listener)
        {
            mInstance = this;
            mListener = listener;
            Settings = settings;

            // 日志设置
            //{
            //    ILogFactory log_factory = new Log4NetLogFactory(settings.Log4NetConfigPath);
            //    EbLogFactory.SetLogFactory(log_factory);
            //    mLog = EbLogFactory.GetLog(this.GetType().Name);

            //    EbLog.NoteCallback = mLog.Info;
            //    EbLog.WarningCallback = mLog.Warn;
            //    EbLog.ErrorCallback = mLog.Error;
            //}

            // 处理未捕获的异常
            AppDomain.CurrentDomain.UnhandledException +=
             new UnhandledExceptionEventHandler(_unhandledExceptionEventHandler);

            EbLog.Note("-----------EsEngine启动开始--------------");

            // EntityMgr初始化
            mEntityMgr = new EntityMgr(Settings.NodeType, Settings.NodeTypeString);

            mEntityMgr.regComponent<ServerNode<DefNode>>();
            mEntityMgr.regComponent<ServerSuperSocket<DefSuperSocket>>();

            mEntityMgr.regEntityDef<EtNode>();
            mEntityMgr.regEntityDef<EtSuperSocket>();

            EtNode = mEntityMgr.createEntity<EtNode>(null, null);
            var co_node = EtNode.getComponent<ServerNode<DefNode>>();
            CoSuperSocket = co_node.CoSuperSocket;

            EbLog.Note("-----------EsEngine启动完毕--------------");

            // 通知业务层初始化
            if (mListener != null)
            {
                mListener.init(mEntityMgr, EtNode);
            }
        }