Exemplo n.º 1
0
        public LazynetAppManager Builder()
        {
            try
            {
                // 获取配置文件配置
                var configInfo = new ConfigurationBuilder()
                                 .SetBasePath(Directory.GetCurrentDirectory())
                                 .AddJsonFile("appsettings.json", optional: true)
                                 .Build();
                var luaScriptConfiguration = configInfo.GetSection("Script");

                // 配置参数
                this.Context        = new LazynetAppContext();
                this.Context.Config = new LazynetAppConfig();

                // 初始化
                this.Context.Timer = new LazynetTimerManager();

                // log
                this.Context.Logger = new LazynetLogger("log4net.config");

                // db
                this.Context.DBProxy = new DBProxy();

                // 服务
                this.Context.ActionProxy = new LazynetActionProxy(this.Context);

                // lua
                this.Context.Lua = new LazynetLua();
                this.Context.Lua.DoFile(luaScriptConfiguration["MainFile"], luaScriptConfiguration["RootDir"]);
            }
            catch (Exception ex)
            {
                this.Context.Log(LazynetLogLevel.Error, ex.ToString());
            }

            return(this);
        }
Exemplo n.º 2
0
 public LazynetAppServer(LazynetAppContext context)
 {
     this.Context = context;
     this.Client  = new LazynetClient(this.Context.Config);
 }
Exemplo n.º 3
0
 public LazynetAppServerHandler(LazynetAppContext context)
 {
     this.Context = context;
 }