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.Logger = new LazynetLogger("log4net.config"); this.Context.Timer = new LazynetTimerManager(); // session manager this.Context.SessionManager = new LazynetSessionManager(); // service 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); }
public LazynetInteriorServer(LazynetAppContext context) { this.Context = context; this.Client = new LazynetClient(new LazynetClientConfig() { IP = this.Context.Config.InteriorServerIP, Port = this.Context.Config.InteriorServerPort, SocketType = this.Context.Config.InteriorServerType }); }
public LazynetExternalServer(LazynetAppContext context) { // 上下文 this.Context = context; this.Server = new LazynetServer(new LazynetServerConfig() { Heartbeat = this.Context.Config.ExternalServerHeartbeat, Port = this.Context.Config.ExternalServerPort, SocketType = this.Context.Config.ExternalServerType, WebsocketPath = this.Context.Config.ExternalServerWebsocketPath }); }
public LazynetExternalServerHandler(LazynetAppContext context) { this.Context = context; }
public LazynetInteriorServerHandler(LazynetAppContext context) { this.Context = context; }