예제 #1
0
        void Start(MSession session)
        {
            // initializing launcher
            var path = Minecraft.GetOSDefaultPath(); // mc directory
            //var path = @"./mctestdir";

            var launcher = new CmlLib.CMLauncher(path);

            launcher.ProgressChanged += Downloader_ChangeProgress;
            launcher.FileChanged     += Downloader_ChangeFile;

            Console.WriteLine($"Initialized in {launcher.Minecraft.path}");

            launcher.UpdateProfileInfos();

            foreach (var item in launcher.ProfileInfos)
            {
                Console.WriteLine(item.Name);
            }

            var launchOption = new MLaunchOption
            {
                MaximumRamMb = 1024,
                Session      = session,
            };

            // launch forge
            // var process = launcher.CreateProcess("1.12.2", "14.23.5.2768", launchOption);

            // launch vanila
            // var process = launcher.CreateProcess("1.15.2", launchOption);

            // launch by user input
            Console.WriteLine("input version : ");
            var process = launcher.CreateProcess(Console.ReadLine(), launchOption);

            Console.WriteLine(process.StartInfo.Arguments);
            process.Start();

            Console.WriteLine("Started");
            Console.ReadLine();

            return;
        }