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);
     }
 }
Example #2
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);
         }
     }
 }
        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);
            }
        }
Example #4
0
 public static void LaunchGame(string[] args)
 {
     LaunchParameters = Utils.ParseArguements(args);
     using (Main main = new Main())
     {
         try
         {
             SocialAPI.Initialize();
             LaunchInitializer.LoadParameters(main);
             main.DedServ();
         }
         catch (Exception e)
         {
             DisplayException(e);
         }
     }
 }
Example #5
0
        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);
            }
        }
Example #6
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);
         }
     }
 }
Example #7
0
 public static void LaunchGame(string[] args, bool monoArgs = false)
 {
     if (monoArgs)
     {
         args = Utils.ConvertMonoArgsToDotNet(args);
     }
     if (Platform.get_IsOSX())
     {
         // ISSUE: reference to a compiler-generated field
         if (Program.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate5 == null)
         {
             // ISSUE: reference to a compiler-generated field
             // ISSUE: method pointer
             Program.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate5 = new Action((object)null, __methodptr(\u003CLaunchGame\u003Eb__4));
         }
         // ISSUE: reference to a compiler-generated field
         Main.OnEngineLoad += Program.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate5;
     }
     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);
             // ISSUE: method pointer
             Main.OnEnginePreload += new Action((object)null, __methodptr(StartForceLoad));
             game.DedServ();
         }
         catch (Exception ex)
         {
             Program.DisplayException(ex);
         }
     }
 }
Example #8
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 { }
     }
 }