Exemplo n.º 1
0
 public static void LaunchGame(string[] args, bool monoArgs = false)
 {
     if (monoArgs)
     {
         args = Utils.ConvertMonoArgsToDotNet(args);
     }
     if (Platform.get_IsOSX())
     {
         Main.OnEngineLoad += (Action)(() => Main.instance.set_IsMouseVisible(false));
     }
     Program.LaunchParameters = Utils.ParseArguements(args);
     ThreadPool.SetMinThreads(8, 8);
     LanguageManager.Instance.SetLanguage(GameCulture.English);
     Program.SetupLogging();
     using (Main game = new Main())
     {
         try
         {
             Program.InitializeConsoleOutput();
             Lang.InitializeLegacyLocalization();
             SocialAPI.Initialize(new SocialMode?());
             LaunchInitializer.LoadParameters(game);
             Main.OnEnginePreload += new Action(Program.StartForceLoad);
             game.Run();
         }
         catch (Exception ex)
         {
             Program.DisplayException(ex);
         }
     }
 }
Exemplo n.º 2
0
 private static void Main(string[] args)
 {
     Marshal.PrelinkAll(typeof(Main));
     ThreadPool.SetMinThreads(0, 0);
     ThreadPool.SetMaxThreads(0, 0);
     using (Main main = new Main())
     {
         try
         {
             main.Run();
         }
         catch (Exception value)
         {
             try
             {
                 using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", append: true))
                 {
                     streamWriter.WriteLine(DateTime.Now);
                     streamWriter.WriteLine(value);
                     streamWriter.WriteLine("");
                 }
             }
             catch
             {
             }
         }
     }
 }
Exemplo n.º 3
0
 public static void LaunchGame(string[] args, bool monoArgs = false)
 {
     Thread.CurrentThread.Name = "Main Thread";
     if (monoArgs)
     {
         args = Utils.ConvertMonoArgsToDotNet(args);
     }
     if (false)
     {
         Main.OnEngineLoad += delegate
         {
             Main.instance.IsMouseVisible = false;
         };
     }
     LaunchParameters = Utils.ParseArguements(args);
     ThreadPool.SetMinThreads(8, 8);
     LanguageManager.Instance.SetLanguage(GameCulture.DefaultCulture);
     InitializeConsoleOutput();
     SetupLogging();
     //Platform.Get<IWindowService>().SetQuickEditEnabled(false);
     using Main main = new Main();
     try
     {
         Lang.InitializeLegacyLocalization();
         //SocialAPI.Initialize();
         LaunchInitializer.LoadParameters(main);
         Main.OnEnginePreload += StartForceLoad;
         main.Run();
     }
     catch (Exception e)
     {
         DisplayException(e);
     }
 }
Exemplo n.º 4
0
 public static void LaunchGame(string[] args)
 {
     Program.LaunchParameters = Utils.ParseArguements(args);
     ThreadPool.SetMinThreads(8, 8);
     LanguageManager.Instance.SetLanguage("English");
     using (Main game = new Main())
     {
         try
         {
             SocialAPI.Initialize(new SocialMode?());
             LaunchInitializer.LoadParameters(game);
             Main.OnEnginePreload += (Action)(() => Program.StartForceLoad());
             game.Run();
         }
         catch (Exception ex)
         {
             Program.DisplayException(ex);
         }
     }
 }
Exemplo n.º 5
0
 public static void LaunchGame(string[] args)
 {
     Program.LaunchParameters = Utils.ParseArguements(args);
     Program.usingSteam = !Program.LaunchParameters.ContainsKey("-usingsteam");  //If it doesn't have that key, we will use Steam
     ThreadPool.SetMinThreads(8, 8);
     using (Main main = new Main())
     {
         try
         {
             if (Program.usingSteam) SocialAPI.Initialize(null);
             LaunchInitializer.LoadParameters(main);
             Main.OnEngineLoad += delegate
             {
                 Program.ForceLoadAssembly(Assembly.GetExecutingAssembly(), true);
             };
             main.Run();
         }
         catch (Exception e)
         {
             Program.DisplayException(e);
         }
     }
 }
		private static void Main(string[] args)
		{
            if (1 == 1)
            {
                PlayerStates test = new PlayerStates(null);
                //DedicatedConfig.test();
                return;
            }
			using (Main main = new Main())
			{
				try
				{
					for (int i = 0; i < args.Length; i++)
					{
						if (args[i].ToLower() == "-port" || args[i].ToLower() == "-p")
						{
							i++;
							try
							{
								int serverPort = Convert.ToInt32(args[i]);
								Netplay.serverPort = serverPort;
							}
							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 ex)
				{
					try
					{
						using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true))
						{
							streamWriter.WriteLine(DateTime.Now);
							streamWriter.WriteLine(ex);
							streamWriter.WriteLine("");
						}
						MessageBox.Show(ex.ToString(), "Terraria: Error");
					}
					catch
					{
					}
				}
			}
		}
Exemplo n.º 7
0
 private static void Main(string[] args)
 {
     /*if (1 == 1)
      * {
      *  //PlayerStates test = new PlayerStates(null);
      *  //DedicatedConfig.test();
      *  Console.WriteLine(Directory.GetCurrentDirectory());
      *  return;
      * }*/
     using (Main main = new Main())
     {
         try
         {
             for (int i = 0; i < args.Length; i++)
             {
                 if (args[i].ToLower() == "-port" || args[i].ToLower() == "-p")
                 {
                     i++;
                     try
                     {
                         int serverPort = Convert.ToInt32(args[i]);
                         Netplay.serverPort = serverPort;
                     }
                     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 ex)
         {
             try
             {
                 using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true))
                 {
                     streamWriter.WriteLine(DateTime.Now);
                     streamWriter.WriteLine(ex);
                     streamWriter.WriteLine("");
                 }
                 MessageBox.Show(ex.ToString(), "Terraria: Error");
             }
             catch
             {
             }
         }
     }
 }
Exemplo n.º 8
0
 private static void Main(string[] args)
 {
     using (Main main = new Main())
     {
         try
         {
             for (int i = 0; i < args.Length; i++)
             {
                 if (args[i].ToLower() == "-port" || args[i].ToLower() == "-p")
                 {
                     i++;
                     try
                     {
                         int serverPort = Convert.ToInt32(args[i]);
                         Netplay.serverPort = serverPort;
                     }
                     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() == "-font")
                 {
                     i++;
                     main.LoadNewFonts(0, args[i]);
                 }
                 if (args[i].ToLower() == "-fis")
                 {
                     i++;
                     main.LoadNewFonts(1, args[i]);
                 }
                 if (args[i].ToLower() == "-fmt")
                 {
                     i++;
                     main.LoadNewFonts(2, args[i]);
                 }
                 if (args[i].ToLower() == "-fdt")
                 {
                     i++;
                     main.LoadNewFonts(3, args[i]);
                 }
                 if (args[i].ToLower() == "-fct")
                 {
                     i++;
                     main.LoadNewFonts(4, args[i]);
                 }
                 if (args[i].ToLower() == "-xc")
                 {
                     main.DisableChatForm();
                 }
                 if (args[i].ToLower() == "-x")
                 {
                     i++;
                     main.SetWindowPos(1, Convert.ToInt32(args[i]));
                 }
                 if (args[i].ToLower() == "-y")
                 {
                     i++;
                     main.SetWindowPos(2, Convert.ToInt32(args[i]));
                 }
                 if (args[i].ToLower() == "-png")
                 {
                     main.EnablePNGMOD();
                 }
             }
             Steam.Init();
             if (Steam.SteamInit)
             {
                 main.Run();
             }
             else
             {
                 MessageBox.Show("Please launch the game from your Steam client.", "Error");
             }
         }
         catch (Exception ex)
         {
             try
             {
                 using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true))
                 {
                     streamWriter.WriteLine(DateTime.Now);
                     streamWriter.WriteLine(ex);
                     streamWriter.WriteLine("");
                 }
                 MessageBox.Show(ex.ToString(), "Terraria: Error");
             }
             catch
             {
             }
         }
     }
 }
Exemplo n.º 9
0
 public static void Main(string[] args)
 {
     try
     {
         using (Main main = new Main())
         {
             Program.LaunchParameters = Utils.ParseArguements(args);
             for (int i = 0; i < args.Length; i++)
             {
                 if (args[i].ToLower() == "-port" || args[i].ToLower() == "-p")
                 {
                     i++;
                     try
                     {
                         int listenPort = Convert.ToInt32(args[i]);
                         Netplay.ListenPort = listenPort;
                     }
                     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.ServerPassword = 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 ex)
     {
         try
         {
             using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true))
             {
                 streamWriter.WriteLine(DateTime.Now);
                 streamWriter.WriteLine(ex);
                 streamWriter.WriteLine("");
             }
             MessageBox.Show(ex.ToString(), "Terraria: Error");
         }
         catch { }
     }
 }
Exemplo n.º 10
0
 private static void Main(string[] args)
 {
     using (Main main = new Main())
     {
         try
         {
             for (int i = 0; i < args.Length; i++)
             {
                 if (args[i].ToLower() == "-port" || args[i].ToLower() == "-p")
                 {
                     i++;
                     try
                     {
                         int serverPort = Convert.ToInt32(args[i]);
                         Netplay.serverPort = serverPort;
                     }
                     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);
                 }
             }
             Steam.Init();
             if (Steam.SteamInit)
             {
                 main.Run();
             }
             else
             {
                 MessageBox.Show("Please launch the game from your Steam client.", "Error");
             }
         }
         catch (Exception ex)
         {
             try
             {
                 using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true))
                 {
                     streamWriter.WriteLine(DateTime.Now);
                     streamWriter.WriteLine(ex);
                     streamWriter.WriteLine("/n");
                 }
                 MessageBox.Show(ex.ToString(), "Terraria: Error");
             }
             catch
             {
             }
         }
     }
 }
		public static void LaunchGame(string[] args)
		{
			Program.LaunchParameters = Utils.ParseArguements(args);
            ThreadPool.SetMinThreads(8, 8);
            using (Main main = new Main())
			{
				try
                {
                    SocialAPI.Initialize(null);
                    LaunchInitializer.LoadParameters(main);
                    Main.OnEngineLoad += delegate
					{
						Program.ForceLoadAssembly(Assembly.GetExecutingAssembly(), true);
					};
#if CLIENT
                    main.Run();
#else
                    main.DedServ();
#endif
                }
                catch (Exception e)
				{
					Program.DisplayException(e);
				}
			}
		}
Exemplo n.º 12
0
 private static void Main(string[] args)
 {
     using (Main main = new Main())
     {
         try
         {
             for (int i = 0; i < args.Length; i++)
             {
                 if (args[i].ToLower() == "-port" || args[i].ToLower() == "-p")
                 {
                     i++;
                     try
                     {
                         int serverPort = Convert.ToInt32(args[i]);
                         Netplay.serverPort = serverPort;
                     }
                     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);
                 }
             }
             //Steam.Init();
             //if (Steam.SteamInit)
             //{
             main.Run();
             //}
             //else
             //{
             //    MessageBox.Show("Please launch the game from your Steam client.", "Error");
             //}
         }
         catch (Exception ex)
         {
             try
             {
                 using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true))
                 {
                     streamWriter.WriteLine(DateTime.Now);
                     streamWriter.WriteLine(ex);
                     streamWriter.WriteLine("");
                 }
                 MessageBox.Show(ex.ToString(), "Terraria: Error");
             }
             catch
             {
             }
         }
     }
 }
Exemplo n.º 13
0
 public static void Main(string[] args)
 {
     try
     {
         using (Main main = new Main())
         {
             Program.LaunchParameters = Utils.ParseArguements(args);
             for (int i = 0; i < args.Length; i++)
             {
                 if (args[i].ToLower() == "-port" || args[i].ToLower() == "-p")
                 {
                     i++;
                     try
                     {
                         int listenPort = Convert.ToInt32(args[i]);
                         Netplay.ListenPort = listenPort;
                     }
                     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.ServerPassword = 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 ex)
     {
         try
         {
             using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true))
             {
                 streamWriter.WriteLine(DateTime.Now);
                 streamWriter.WriteLine(ex);
                 streamWriter.WriteLine("");
             }
             MessageBox.Show(ex.ToString(), "Terraria: Error");
         }
         catch { }
     }
 }