Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            MLogin   login   = new MLogin();
            MSession session = MSession.GetOfflineSession(textBox1.Text);

            session = login.TryAutoLogin();
            Minecraft.Initialize(Path.Combine(appDataPath, @"SkyLauncher\"));
            MProfileInfo[] infos   = MProfileInfo.GetProfiles();
            MProfile       profile = MProfile.FindProfile(infos, "1.12.2");

            DownloadGame(profile);

            var option = new MLaunchOption()
            {
                // must require
                StartProfile = profile,
                JavaPath     = "java.exe", //SET YOUR JAVA PATH (if you want autoset, goto wiki)
                MaximumRamMb = 4096,       // MB
                Session      = MSession.GetOfflineSession(textBox1.Text),

                // not require
                LauncherName        = "McLauncher", // display launcher name at main window
                CustomJavaParameter = ""            // set your own java args
            };

            MLaunch launch = new MLaunch(option);

            launch.GetProcess().Start();
        }
Ejemplo n.º 2
0
        private void Btn_Launch_Click(object sender, EventArgs e)
        {
            // Launch

            if (session == null)
            {
                MessageBox.Show("Login First");
                return;
            }

            if (Cb_Version.Text == "")
            {
                return;
            }
            groupBox1.Enabled = false;
            groupBox2.Enabled = false;

            string startVersion = Cb_Version.Text;
            string javaPath     = Txt_Java.Text;
            string xmx          = Txt_Ram.Text;
            string launcherName = Txt_LauncherName.Text;
            string serverIp     = Txt_ServerIp.Text;

            var th = new Thread(new ThreadStart(delegate
            {
                var profile = MProfile.FindProfile(versions, startVersion); // Find Profile

                DownloadGame(profile);                                      // Download game files

                MLaunchOption option = new MLaunchOption()                  // Set options
                {
                    StartProfile        = profile,
                    JavaPath            = javaPath,
                    LauncherName        = launcherName,
                    MaximumRamMb        = int.Parse(xmx),
                    ServerIp            = serverIp,
                    Session             = session,
                    CustomJavaParameter = Txt_JavaArgs.Text
                };

                if (Txt_ScWd.Text != "" && Txt_ScHt.Text != "")
                {
                    option.ScreenHeight = int.Parse(Txt_ScHt.Text);
                    option.ScreenWidth  = int.Parse(Txt_ScWd.Text);
                }

                MLaunch launch = new MLaunch(option); // Start Process
                var process    = launch.GetProcess();

                DebugProcess(process);

                this.Invoke((MethodInvoker) delegate
                {
                    groupBox1.Enabled = true;
                    groupBox2.Enabled = true;
                });
            }));

            th.Start();
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            MLogin   login   = new MLogin();
            MSession session = MSession.GetOfflineSession(textBox1.Text);

            session = login.TryAutoLogin();
            Minecraft.Initialize(Path.Combine(appDataPath, @"SkyLauncher\"));
            MProfileInfo[] infos   = MProfileInfo.GetProfiles();
            MProfile       profile = MProfile.FindProfile(infos, comboBox1.SelectedItem.ToString());

            DownloadGame(profile);

            var option = new MLaunchOption()
            {
                // must require
                StartProfile = profile,
                JavaPath     = "java.exe", //JAVA PAT
                MaximumRamMb = 4096,       // MB
                Session      = MSession.GetOfflineSession(textBox1.Text),

                // not require
                LauncherName        = "SkyLauncher",
                CustomJavaParameter = "" // java args
            };

            MLaunch launch = new MLaunch(option);

            launch.GetProcess().Start();
        }
Ejemplo n.º 4
0
        public MProfile GetProfile(string versionname)
        {
            if (ProfileInfos == null || ProfileInfos.Length == 0)
            {
                UpdateProfileInfos();
            }

            return(MProfile.FindProfile(Minecraft, ProfileInfos, versionname));
        }
Ejemplo n.º 5
0
        public MProfile GetProfile()
        {
            Minecraft.Initialize(Directory.GetCurrentDirectory() + @"\Minecraft\.minecraft");

            MProfileInfo[] versions = MProfileInfo.GetProfiles();
            MProfile       profile  = MProfile.FindProfile(versions, MINECRAFT_VERSION);

            return(profile);
        }