Beispiel #1
0
        static void Main( string[] args )
        {
            ErrorHandler.InstallHandler( "client.log" );

            Utils.LogDebug( "Starting " + AppName + ".." );
            if( !File.Exists( "default.zip" ) ) {
                Utils.LogDebug( "default.zip not found. Cannot start." );
                return;
            }
            bool nullContext = true;
            #if !USE_DX
            nullContext = false;
            #endif
            int width, height;
            SelectResolution( out width, out height );

            if( args.Length == 0 || args.Length == 1 ) {
                const string skinServer = "http://s3.amazonaws.com/MinecraftSkins/";
                string pack = args.Length >= 1 ? args[0] : "default.zip";

                using( Game game = new Game( "LocalPlayer", null, skinServer,
                                            pack, nullContext, width, height ) )
                    game.Run();
            } else if( args.Length < 4 ) {
                Utils.LogDebug( "ClassicalSharp.exe is only the raw client. You must either use the launcher or"
                     + " provide command line arguments to start the client." );
            } else {
                RunMultiplayer( args, nullContext, width, height );
            }
        }
Beispiel #2
0
        public static void Main( string[] args )
        {
            if( !Debugger.IsAttached ) {
                AppDomain.CurrentDomain.UnhandledException += UnhandledException;
            }

            Utils.Log( "Starting " + Utils.AppName + ".." );
            if( !File.Exists( "default.zip" ) ) {
                Fail( "default.zip not found. Cannot start." );
                return;
            }

            if( args.Length == 0 || args.Length == 1 ) {
                Utils.Log( "Starting singleplayer mode." );
                const string skinServer = "http://s3.amazonaws.com/MinecraftSkins/";
                using( Game game = new Game( "LocalPlayer", null, skinServer, "default.zip" ) ) {
                    game.Run();
                }
            } else if( args.Length < 4 ) {
                Fail( "ClassicalSharp.exe is only the raw client. You must either use the launcher or"
                     + " provide command line arguments to start the client." );
            } else {
                RunMultiplayer( args );
            }
        }
        static void Main( string[] args )
        {
            AppDirectory = AppDomain.CurrentDomain.BaseDirectory;
            string logPath = Path.Combine( AppDirectory, "client.log" );
            ErrorHandler.InstallHandler( logPath );
            CleanupMainDirectory();

            Utils.LogDebug( "Starting " + AppName + ".." );
            string path = Path.Combine( Program.AppDirectory, TexturePackExtractor.Dir );
            if( !File.Exists( Path.Combine( path, "default.zip" ) ) ) {
                Utils.LogDebug( "default.zip not found. Cannot start." );
                return;
            }

            bool nullContext = true;
            #if !USE_DX
            nullContext = false;
            #endif
            int width, height;
            SelectResolution( out width, out height );

            if( args.Length == 0 || args.Length == 1 ) {
                const string skinServer = "http://static.classicube.net/skins/";
                string user = args.Length > 0 ? args[0] : "Singleplayer";
                using( Game game = new Game( user, null, skinServer, nullContext, width, height ) )
                    game.Run();
            } else if( args.Length < 4 ) {
                Utils.LogDebug( "ClassicalSharp.exe is only the raw client. You must either use the launcher or"
                     + " provide command line arguments to start the client." );
            } else {
                RunMultiplayer( args, nullContext, width, height );
            }
        }
Beispiel #4
0
        static void RunMultiplayer( string[] args )
        {
            IPAddress ip = null;
            if( !IPAddress.TryParse( args[2], out ip ) ) {
                Fail( "Invalid IP \"" + args[2] + '"' );
            }

            int port = 0;
            if( !Int32.TryParse( args[3], out port ) ) {
                Fail( "Invalid port \"" + args[3] + '"' );
                return;
            } else if( port < ushort.MinValue || port > ushort.MaxValue ) {
                Fail( "Specified port " + port + " is out of valid range." );
            }

            string skinServer = args.Length >= 5 ? args[4] : "http://s3.amazonaws.com/MinecraftSkins/";
            using( Game game = new Game( args[0], args[1], skinServer, "default.zip" ) ) {
                game.IPAddress = ip;
                game.Port = port;
                game.Run();
            }
        }
Beispiel #5
0
        static void Main( string[] args )
        {
            ErrorHandler.InstallHandler( "client.log" );

            Utils.Log( "Starting " + AppName + ".." );
            if( !File.Exists( "default.zip" ) ) {
                Fail( "default.zip not found. Cannot start." );
                return;
            }

            if( args.Length == 0 || args.Length == 1 ) {
                Utils.Log( "Starting singleplayer mode." );
                const string skinServer = "http://s3.amazonaws.com/MinecraftSkins/";
                string pack = args.Length >= 1 ? args[0] : "default.zip";
                using( Game game = new Game( "LocalPlayer", null, skinServer, pack ) ) {
                    game.Run();
                }
            } else if( args.Length < 4 ) {
                Fail( "ClassicalSharp.exe is only the raw client. You must either use the launcher or"
                     + " provide command line arguments to start the client." );
            } else {
                RunMultiplayer( args );
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
            ErrorHandler.InstallHandler("client.log");
            Utils.LogDebug("Starting " + AppName + "..");


            Utils.EnsureDirectory("maps");
            Utils.EnsureDirectory("texpacks");
            Utils.EnsureDirectory("texturecache");

            string defPath = Path.Combine("texpacks", "default.zip");

            if (!Platform.FileExists(defPath))
            {
                ErrorHandler.ShowDialog("Failed to start", "default.zip is missing, try running the launcher first.");
                return;
            }
            OpenTK.Configuration.SkipPerfCountersHack();


            IPAddress ip = null;
            int       port = 0;
            string    user = null, mppass = null;
            string    skinServer = "http://static.classicube.net/skins/";

            if (args.Length == 0 || args.Length == 1)
            {
                user = args.Length > 0 ? args[0] : "Singleplayer";
            }
            else if (args.Length < 4)
            {
                ErrorHandler.ShowDialog("Failed to start", "ClassicalSharp.exe is only the raw client\n\n." +
                                        "Use the launcher instead, or provide command line arguments");
                return;
            }
            else
            {
                user   = args[0];
                mppass = args[1];
                if (args.Length > 4)
                {
                    skinServer = args[4];
                }

                if (!IPAddress.TryParse(args[2], out ip))
                {
                    ErrorHandler.ShowDialog("Failed to start", "Invalid IP " + args[2]); return;
                }
                if (!Int32.TryParse(args[3], out port) || port <0 || port> ushort.MaxValue)
                {
                    ErrorHandler.ShowDialog("Failed to start", "Invalid port " + args[3]); return;
                }
            }

            Options.Load();
            DisplayDevice device = DisplayDevice.Default;
            int           width  = Options.GetInt(OptionsKey.WindowWidth, 0, device.Bounds.Width, 0);
            int           height = Options.GetInt(OptionsKey.WindowHeight, 0, device.Bounds.Height, 0);

            // No custom resolution has been set
            if (width == 0 || height == 0)
            {
                width = 854; height = 480;
                if (device.Bounds.Width < 854)
                {
                    width = 640;
                }
            }

            using (Game game = new Game(user, mppass, skinServer, width, height)) {
                game.IPAddress = ip;
                game.Port      = port;
                game.Run();
            }
        }