protected void Application_Start(object sender, EventArgs e) { try { if (!GameEnvironment.IsRunning) { var setting = new EnvironmentSetting(); GameEnvironment.Start(setting); ScriptEngines.RunMainClass(out _instance); } } catch (Exception ex) { TraceLog.WriteError("App star error:{0}", ex); } }
static void Main(string[] args) { string date = DateTime.Now.ToString("HH:mm:ss"); try { ConsoleColor currentForeColor = Console.ForegroundColor; var setting = new EnvironmentSetting(); Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine(string.Format(CharFormat, Assembly.GetExecutingAssembly().GetName().Version, setting.ProductCode, setting.ProductServerId, setting.GamePort)); GameEnvironment.Start(setting); Console.ForegroundColor = currentForeColor; dynamic instance; if (ScriptEngines.RunMainClass(out instance, args)) { Console.WriteLine("{0} Server has started successfully!", date); Console.WriteLine("# Server is listening..."); } else { Console.WriteLine("{0} Server failed to start!", date); } Console.ReadKey(); if (instance != null) { instance.Stop(); } } catch (Exception ex) { Console.WriteLine("{0} Server failed to start!", date); TraceLog.WriteError("Server failed to start error:{0}", ex); Console.ReadKey(); } }
static void Main(string[] args) { string date = DateTime.Now.ToString("HH:mm:ss"); try { var setting = new EnvironmentSetting(); Console.WriteLine(string.Format(CharFormat, "6.1.6.0", setting.ProductCode, setting.ProductServerId, setting.GamePort)); GameEnvironment.Start(setting); dynamic instance; if (ScriptEngines.RunMainClass(out instance, args)) { Console.WriteLine("{0} Server has started successfully!", date); Console.WriteLine("# Server is listening..."); } else { Console.WriteLine("{0} Server failed to start!", date); } Console.ReadKey(); if (instance != null) { instance.Stop(); } } catch (Exception ex) { Console.WriteLine("{0} Server failed to start!", date); TraceLog.WriteError("Server failed to start error:{0}", ex); Console.ReadKey(); } }