Esempio n. 1
0
        public void start(MSession session, string version)
        {
            var McPath   = Minecraft.GetOSDefaultPath();
            var launcher = new CmlLib.CMLauncher(McPath);
            // ignore 2 errors
            var launchOptions = new MLaunchOption
            {
                MaximumRamMb = 2048,
                Session      = session,
            };
            var process = launcher.CreateProcess(version, launchOptions);

            process.Start();
        }
Esempio n. 2
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;
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var lp = MLauncherProfile.LoadFromDefaultPath();

            System.Diagnostics.Debug.Write(lp);

            //var path = new Minecraft("your minecraft directory);
            var path = MinecraftPath.GetOSDefaultPath(); // mc directory

            var launcher = new CmlLib.CMLauncher(path);

            launcher.ProgressChanged += (s, e) =>
            {
                Console.WriteLine("{0}%", e.ProgressPercentage);
            };
            launcher.FileChanged += (e) =>
            {
                Console.WriteLine("[{0}] {1} - {2}/{3}", e.FileKind.ToString(), e.FileName, e.ProgressedFileCount, e.TotalFileCount);
            };

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

            var launchOption = new MLaunchOption
            {
                MaximumRamMb = 1024,
                Session      = MSession.GetOfflineSession("hello"), // Login Session. ex) Session = MSession.GetOfflineSession("hello")

                //LauncherName = "MyLauncher",
                //ScreenWidth = 1600,
                //ScreenHeigth = 900,
                //ServerIp = "mc.hypixel.net"
            };

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

            process.Start();
        }