private static void Main(string[] args) { Terraria.Main main = new Terraria.Main(); try { for (int i = 0; i < args.Length; i++) { if ((args[i].ToLower() == "-port") || (args[i].ToLower() == "-p")) { i++; try { Netplay.serverPort = Convert.ToInt32(args[i]); } catch { } } if ((args[i].ToLower() == "-join") || (args[i].ToLower() == "-j")) { i++; try { main.AutoJoin(args[i]); } catch { } } if ((args[i].ToLower() == "-pass") || (args[i].ToLower() == "-password")) { i++; Netplay.password = args[i]; main.AutoPass(); } if (args[i].ToLower() == "-host") { main.AutoHost(); } if (args[i].ToLower() == "-loadlib") { i++; string path = args[i]; main.loadLib(path); } } main.Run(); } catch (Exception exception) { try { using (StreamWriter writer = new StreamWriter("client-crashlog.txt", true)) { writer.WriteLine(DateTime.Now); writer.WriteLine(exception); writer.WriteLine(""); } MessageBox.Show(exception.ToString(), "Terraria: Error"); } catch { } } finally { if (main != null) { main.Dispose(); } } }
private static void Main(string[] args) { try { Game = new Terraria.Main(); for (int i = 0; i < args.Length; i++) { if (args[i].ToLower() == "-config") { i++; Game.LoadDedConfig(args[i]); } if (args[i].ToLower() == "-port") { i++; try { Netplay.serverPort = Convert.ToInt32(args[i]); } catch { } } if ((args[i].ToLower() == "-players") || (args[i].ToLower() == "-maxplayers")) { i++; try { int mPlayers = Convert.ToInt32(args[i]); Game.SetNetPlayers(mPlayers); } catch { } } if ((args[i].ToLower() == "-pass") || (args[i].ToLower() == "-password")) { i++; Netplay.password = args[i]; } if (args[i].ToLower() == "-world") { i++; Game.SetWorld(args[i]); } if (args[i].ToLower() == "-worldname") { i++; Game.SetWorldName(args[i]); } if (args[i].ToLower() == "-motd") { i++; Game.NewMOTD(args[i]); } if (args[i].ToLower() == "-banlist") { i++; Netplay.banFile = args[i]; } if (args[i].ToLower() == "-autoshutdown") { Game.autoShut(); } if (args[i].ToLower() == "-secure") { Netplay.spamCheck = true; } if (args[i].ToLower() == "-autocreate") { i++; string newOpt = args[i]; Game.autoCreate(newOpt); } if (args[i].ToLower() == "-loadlib") { i++; string path = args[i]; Game.loadLib(path); } } Game.DedServ(); } catch (Exception exception) { try { using (StreamWriter writer = new StreamWriter("crashlog.txt", true)) { writer.WriteLine(DateTime.Now); writer.WriteLine(exception); writer.WriteLine(""); } Console.WriteLine("Server crash: " + DateTime.Now); Console.WriteLine(exception); Console.WriteLine(""); Console.WriteLine("Please send crashlog.txt to [email protected]"); } catch { } } }
private static void Main(string[] args) { Terraria.Main main = new Terraria.Main(); try { for (int i = 0; i < args.Length; i++) { if ((args[i].ToLower() == "-port") || (args[i].ToLower() == "-p")) { i++; try { Netplay.serverPort = Convert.ToInt32(args[i]); } catch { } } if ((args[i].ToLower() == "-join") || (args[i].ToLower() == "-j")) { i++; try { main.AutoJoin(args[i]); } catch { } } if ((args[i].ToLower() == "-pass") || (args[i].ToLower() == "-password")) { i++; Netplay.password = args[i]; main.AutoPass(); } if (args[i].ToLower() == "-host") { main.AutoHost(); } if (args[i].ToLower() == "-loadlib") { i++; string path = args[i]; main.loadLib(path); } if (args[i].ToLower() == "-nosplash") ZidoMod.nosplash(); } main.Run(); } catch (Exception exception) { try { using (StreamWriter writer = new StreamWriter("client-crashlog.txt", true)) { writer.WriteLine(DateTime.Now); writer.WriteLine(exception); writer.WriteLine(""); } MessageBox.Show(exception.ToString(), "Terraria: Error"); } catch { } } finally { if (main != null) { main.Dispose(); } } }
private static void Main(string[] args) { Terraria.Main main = new Terraria.Main(); try { for (int i = 0; i < args.Length; i++) { if ((args[i].ToLower() == "-port") || (args[i].ToLower() == "-p")) { i++; try { Netplay.serverPort = Convert.ToInt32(args[i]); } catch { } } if ((args[i].ToLower() == "-join") || (args[i].ToLower() == "-j")) { i++; try { main.AutoJoin(args[i]); } catch { } } if ((args[i].ToLower() == "-pass") || (args[i].ToLower() == "-password")) { i++; Netplay.password = args[i]; main.AutoPass(); } if (args[i].ToLower() == "-host") { main.AutoHost(); } if (args[i].ToLower() == "-loadlib") { i++; string path = args[i]; main.loadLib(path); } } #if DEBUG main.Run(); #else Steam.Init(); if (Steam.SteamInit) { main.Run(); } else { MessageBox.Show("Please run the game with steam running also.", "Error"); } #endif } catch (Exception exception) { try { using (StreamWriter writer = new StreamWriter("client-crashlog.txt", true)) { writer.WriteLine(DateTime.Now); writer.WriteLine(exception); writer.WriteLine(""); } MessageBox.Show(exception.ToString(), "Terraria: Error"); } catch { } } finally { if (main != null) { #if !DEBUG Steam.Kill(); #endif main.Dispose(); } } }