Exemplo n.º 1
0
 /// <summary>
 /// Central program entry point.
 /// Decides whether to lauch the server or the client.
 /// </summary>
 /// <param name="args">The command line arguments.</param>
 static void Main(string[] args)
 {
     ConsoleHandle = Process.GetCurrentProcess().MainWindowHandle;
     VoxProgram.PreInitVox();
     SysConsole.Init();
     VoxProgram.Init();
     try
     {
         string game = "default";
         if (args.Length > 0)
         {
             game = args[0];
             string[] t = new string[args.Length - 1];
             Array.Copy(args, 1, t, 0, t.Length);
             args = t;
         }
         Server.Init(game, args);
     }
     catch (Exception ex)
     {
         if (ex is ThreadAbortException)
         {
             Console.WriteLine("Forced shutdown - terminating process.");
             Environment.Exit(0);
             return;
         }
         SysConsole.Output(ex);
         File.WriteAllText("GLOBALERR_" + DateTime.Now.ToFileTimeUtc().ToString() + ".txt", ex.ToString() + "\n\n" + Environment.StackTrace);
     }
     SysConsole.ShutDown();
     Console.WriteLine("Final shutdown - terminating process.");
     Environment.Exit(0);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Central program entry point.
        /// Decides whether to lauch the server or the client.
        /// </summary>
        /// <param name="args">The command line arguments.</param>
        static void Main(string[] args)
        {
            ConsoleHandle = Process.GetCurrentProcess().MainWindowHandle;
            if (args.Length == 1 && args[0] == "{{Launcher}}")
            {
                args = new string[0];
#if !LINUX
                ShowWindow(ConsoleHandle, SW_HIDE);
#endif
            }
            VoxProgram.PreInit();
            SysConsole.AllowCursor = false;
            SysConsole.Init();
            StringBuilder arger = new StringBuilder();
            for (int i = 0; i < args.Length; i++)
            {
                arger.Append(args[i]).Append(' ');
            }
            try
            {
                VoxProgram.Init();
                if (args.Length > 0 && args[0] == "server")
                {
                    string[] targs = new string[args.Length - 1];
                    Array.Copy(args, 1, targs, 0, targs.Length);
                    args = targs;
                    string game = "default";
                    if (args.Length > 0)
                    {
                        game = args[0];
                        string[] t = new string[args.Length - 1];
                        Array.Copy(args, 1, t, 0, t.Length);
                        args = t;
                    }
                    Server.Init(game, args);
                }
                else
                {
                    Client.Init(arger.ToString());
                }
            }
            catch (Exception ex)
            {
                if (ex is ThreadAbortException)
                {
                    Console.WriteLine("Forced shutdown - terminating process.");
                    Environment.Exit(0);
                    return;
                }
                SysConsole.Output(ex);
                File.WriteAllText("GLOBALERR_" + DateTime.Now.ToFileTimeUtc().ToString() + ".txt", ex.ToString() + "\n\n" + Environment.StackTrace);
            }
            SysConsole.ShutDown();
            Console.WriteLine("Final shutdown - terminating process.");
            Environment.Exit(0);
        }
Exemplo n.º 3
0
 /// <summary>
 /// ALWAYS call this in a test's static OneTimeSetUp!
 /// </summary>
 public static void Setup()
 {
     VoxProgram.PreInit();
 }