private void Main_Shown(object sender, EventArgs e) { // Initialize launcher Txt_Path.Text = Minecraft.GetOSDefaultPath(); var th = new Thread(new ThreadStart(delegate { InitializeLauncher(); // Try auto login var login = new MLogin(); MSession result = login.TryAutoLogin(); if (result.Result != MLoginResult.Success) { return; } MessageBox.Show("¡Auto inicio de sesión completado!\n\nUsuario: " + result.Username); Session = result; Invoke((MethodInvoker) delegate { Btn_Login.Enabled = false; Btn_Login.Text = "Auto inicio\nCompletado"; Txt_User.Text = Session.Username; Txt_Pass.Text = "#########"; }); })); th.Start(); }
MSession PremiumLogin() { var login = new MLogin(); // TryAutoLogin() read login cache file and check validation. // if cached session is invalid, it refresh session automatically. // but refreshing session doesn't always succeed, so you have to handle this. Console.WriteLine("Try Auto login"); Console.WriteLine(login.SessionCacheFilePath); var response = login.TryAutoLogin(); if (!response.IsSuccess) // cached session is invalid and failed to refresh token { Console.WriteLine("Auto login failed : {0}", response.Result.ToString()); Console.WriteLine("Input mojang email : "); var email = Console.ReadLine(); Console.WriteLine("Input mojang password : "******"failed to login. {0} : {1}", response.Result, response.ErrorMessage); Console.ReadLine(); Environment.Exit(0); return(null); } } return(response.Session); }
private void LoginActive(object sender, RoutedEventArgs e) { var th = new Thread(new ThreadStart(delegate { var login = new MLogin(); var session = login.TryAutoLogin(); if (session.Result == MLoginResult.Success) { Application.Current.Dispatcher.Invoke((Action) delegate { { MainWindowNew mw = new MainWindowNew(session); mw.Show(); this.Close(); } }); } else { Dispatcher.BeginInvoke(new Action(delegate { LoginCover.Visibility = Visibility.Hidden; LoginCover.IsEnabled = false; })); } })); th.Start(); }
private void btnAutoLogin_Click(object sender, EventArgs e) { gMojangLogin.Enabled = false; var th = new Thread(() => { var result = login.TryAutoLogin(); if (result.Result != MLoginResult.Success) { MessageBox.Show($"Failed to AutoLogin : {result.Result}\n{result.ErrorMessage}"); Invoke(new Action(() => { gMojangLogin.Enabled = true; })); return; } MessageBox.Show("Auto Login Success!"); Invoke(new Action(() => { gMojangLogin.Enabled = true; btnAutoLogin.Enabled = false; btnLogin.Enabled = false; btnLogin.Text = "Auto Login\nSuccess"; UpdateSession(result.Session); })); }); th.Start(); }
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(); }
private void MainForm_Shown(object sender, EventArgs e) { // Initialize launcher Txt_Path.Text = Minecraft.GetOSDefaultPath(); var th = new Thread(new ThreadStart(delegate { InitializeLauncher(); // Try auto login var login = new MLogin(); MSession result = login.TryAutoLogin(); if (result.Result != MLoginResult.Success) { return; } MessageBox.Show("Auto Login Success!"); Session = result; Invoke((MethodInvoker) delegate { Btn_Login.Enabled = false; Btn_Login.Text = "Auto Login\nSuccess"; }); })); th.Start(); }
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(); }
public MSession Login(string loginEmail, string LoginPass, bool ifPremium) { var session = new MSession(); if (ifPremium) { var login = new MLogin(); session = login.TryAutoLogin(); session = login.Authenticate(loginEmail, LoginPass); if (session.Result != MLoginResult.Success) { LoggerUpdate("[Auth]" + "Unsuccessful Login"); return(null); } else { LoggerUpdate("[Auth] Successful Login"); } accessToken = session.AccessToken; } else { session = MSession.GetOfflineSession(offlineUsername); } return(session); }
public void TryAutoLogin() { MLogin Log = new MLogin(); MLoginResponse Response = Log.TryAutoLogin(); if (Response.IsSuccess) { CurrentSession = Response.Session; } }
public MSession AutoLogin() { MLogin login = new MLogin(); MSession session = login.TryAutoLogin(); if (session.Result != MLoginResult.Success) { return(null); } return(session); }
private void tryautologin() { var login = new MLogin(); var session = login.TryAutoLogin(); if (session.Result == MLoginResult.Success) { MainWindowNew mw = new MainWindowNew(session); this.Close(); mw.Show(); } else { LoginCover.Visibility = Visibility.Hidden; LoginCover.IsEnabled = false; } }
MSession Login() { bool premiumMode = false; MSession session; if (premiumMode) { Console.WriteLine("Try Auto login"); var login = new MLogin(); session = login.TryAutoLogin(); if (session.Result != MLoginResult.Success) { Console.WriteLine("Auto login failed : {0}", session.Result.ToString()); Console.WriteLine("Input mojang email : "); var email = Console.ReadLine(); Console.WriteLine("Input mojang password : "******"failed to login. {0} : {1}", session.Result.ToString(), session.Message); Console.ReadLine(); return(null); } } } else { session = MSession.GetOfflineSession("tester123"); } Console.WriteLine("Success to login : {0} / {1} / {2}", session.Username, session.UUID, session.AccessToken); return(session); }
private void Main_Shown(object sender, EventArgs e) { // Initialize launcher Path.Text = Environment.GetEnvironmentVariable("appdata") + "\\.minecraft"; var th = new Thread(new ThreadStart(delegate { Minecraft.Initialize(Path.Text); versions = MProfileInfo.GetProfiles(); Invoke((MethodInvoker) delegate { foreach (var item in versions) { Cb_Version.Items.Add(item.Name); } }); // Try auto login var login = new MLogin(); MSession result = login.TryAutoLogin(); if (result.Result != MLoginResult.Success) { return; } MessageBox.Show("Auto Login Success!"); session = result; Invoke((MethodInvoker) delegate { Btn_Login.Enabled = false; Btn_Login.Text = "Auto Login\nSuccess"; }); })); th.Start(); }
private void Form1_Shown(object sender, EventArgs e) { // 런처가 실행되었을때 // Minecraft.init // MProfileInfo 리스트 불러옴 // 자동 로그인 시도 textBox1.Text = Environment.GetEnvironmentVariable("appdata") + "\\.minecraft"; var th = new Thread(new ThreadStart(delegate { Minecraft.init(textBox1.Text); versions = MProfileInfo.GetProfiles(); Invoke((MethodInvoker) delegate { foreach (var item in versions) { Cb_Version.Items.Add(item.Name); } }); var login = new MLogin(); MSession result = login.TryAutoLogin(); if (result.Result != MLoginResult.Success) { return; } MessageBox.Show("Auto Login Success!"); session = result; Invoke((MethodInvoker) delegate { Btn_Login.Enabled = false; }); })); th.Start(); }