コード例 #1
0
ファイル: MainProgramServer.cs プロジェクト: MoTo1496/Voxalia
 /// <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);
 }
コード例 #2
0
ファイル: MainProgram.cs プロジェクト: MoTo1496/Voxalia
        /// <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];
                SysConsole.AllowCursor = false;
#if !LINUX
                ShowWindow(ConsoleHandle, SW_HIDE);
#endif
            }
            VoxProgram.PreInitVox();
            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);
        }