private static void InnerStart(string[] args) { try { Program.LaunchParameters = Utils.ParseArguements(args); ProgramServer.Game = new Main(); string str = null; if (str != null) { ProgramServer.Game.SetWorld(str); } try { Console.WriteLine("TerrariaAPI Version: " + ServerApi.ApiVersion + " (Protocol {0} ({1}))", Terraria.Main.versionNumber2, Terraria.Main.curRelease); Console.WriteLine("SendQ edition"); ServerApi.Initialize(args, Game); } catch (Exception ex) { ServerApi.LogWriter.ServerWriteLine( "Startup aborted due to an exception in the Server API initialization:\n" + ex, TraceLevel.Error); Console.ReadLine(); return; } ProgramServer.Game.DedServ(); ServerApi.DeInitialize(); } catch (Exception exception1) { ServerApi.LogWriter.ServerWriteLine("Server crashed due to an unhandled exception:\n" + exception1, TraceLevel.Error); } }
private static void InnerStart(string[] args) { try { Program.LaunchParameters = Utils.ParseArguements(args); ProgramServer.Game = new Main(); string str = null; int num = 0; SocialMode socialMode = SocialMode.None; while (num < (int)args.Length) { if (args[num].ToLower() == "-steam") { socialMode = SocialMode.Steam; } num++; } SocialAPI.Initialize(new SocialMode?(socialMode)); if (str != null) { ProgramServer.Game.SetWorld(str); } try { Console.WriteLine("TerrariaAPI Version: " + ServerApi.ApiVersion + " (Protocol {0} ({1}))", Terraria.Main.versionNumber2, Terraria.Main.curRelease); Console.WriteLine("SendQ edition"); ServerApi.Initialize(args, Game); } catch (Exception ex) { ServerApi.LogWriter.ServerWriteLine( "Startup aborted due to an exception in the Server API initialization:\n" + ex, TraceLevel.Error); Console.ReadLine(); return; } ProgramServer.Game.DedServ(); ServerApi.DeInitialize(); } catch (Exception exception1) { ServerApi.LogWriter.ServerWriteLine("Server crashed due to an unhandled exception:\n" + exception1, TraceLevel.Error); } }
public static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += UnhandledException; try { InitialiseInternals(); ServerApi.Hooks.AttachOTAPIHooks(args); // avoid any Terraria.Main calls here or the heaptile hook will not work. // this is because the hook is executed on the Terraria.Main static constructor, // and simply referencing it in this method will trigger the constructor. StartServer(args); ServerApi.DeInitialize(); } catch (Exception ex) { ServerApi.LogWriter.ServerWriteLine("Server crashed due to an unhandled exception:\n" + ex, TraceLevel.Error); } }
private static void Main(string[] args) { try { Game = new Main(); if (Environment.OSVersion.Platform == PlatformID.Unix) { Terraria.Main.SavePath = "Terraria"; } else { Terraria.Main.SavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "My Games", "Terraria"); } Terraria.Main.WorldPath = Path.Combine(Terraria.Main.SavePath, "Worlds"); Terraria.Main.PlayerPath = Path.Combine(Terraria.Main.SavePath, "Players"); try { Console.WriteLine("TerrariaAPI Version: " + ServerApi.ApiVersion + " (Protocol {0})", Terraria.Main.versionNumber2); ServerApi.Initialize(args, Game); } catch (Exception ex) { ServerApi.LogWriter.ServerWriteLine( "Startup aborted due to an exception in the Server API initialization:\n" + ex, TraceLevel.Error); Console.ReadLine(); return; } Game.DedServ(); ServerApi.DeInitialize(); } catch (Exception ex) { ServerApi.LogWriter.ServerWriteLine("Server crashed due to an unhandled exception:\n" + ex, TraceLevel.Error); Console.ReadLine(); } }