public void CheckLoginInfo() { if (DataHolder.HasLoginInfo) { btnLoginInfo.Text = "Delete saved"; lblLoginInfo.Text = "Stored info: \r\nusername: "******"\r\npassword (encrypted): " + DataHolder.GetLoginInfo().GetPassword(); } else { btnLoginInfo.Text = "Store"; lblLoginInfo.Text = "No stored information"; } }
private void button1_Click(object sender, EventArgs e) { string param = ""; if (DataHolder.HasLoginInfo) { param += DataHolder.GetLoginInfo().GetName() + " " + DataHolder.GetLoginInfo().GetDecryptedPassword(); } if (checkBox1.Checked) { Directory.Delete(Data.minecraftbin, true); } else { } Process.Start(Data.minecraftexe, param); }
public void StartMinecraftWithoutLauncher() { LoginInfo li; if (DataHolder.HasLoginInfo) { li = DataHolder.GetLoginInfo(); } else { li = LoginInput.Show(); if (li == null) { MessageBox.Show("Please type in username and password!", "Login Error"); return; } } try { WebClient wc = new WebClient(); string loginURI = String.Format("http://login.minecraft.net/?user={0}&password={1}&version=14", li.GetName(), li.GetDecryptedPassword()); string str = wc.DownloadString(loginURI); if (str != "Bad login") { string[] args = str.Split(':'); Process mc = new Process(); mc.StartInfo.FileName = "java.exe"; mc.StartInfo.Arguments = String.Format("-Xincgc -Xmx1024m -cp \"" + Data.minecraftbin + "minecraft.jar;" + Data.minecraftbin + "lwjgl.jar;" + Data.minecraftbin + "lwjgl_util.jar;" + Data.minecraftbin + "jinput.jar\" -Djava.library.path=\"" + Data.minecraftbin + "natives\" net.minecraft.client.Minecraft {0} {1}", args[2], args[3]); mc.Start(); } else { MessageBox.Show("Invalid Login! try again..."); } } catch (WebException ex) { MessageBox.Show("Can't connect to login.minecraft.net, try again later or start with launcher to play offline\r\nMore information: " + ex.ToString()); } }
public void StartMinecraftWithLauncher() { Process[] javas; bool start = true; if ((javas = Process.GetProcessesByName("javaw")).Length > 0) { foreach (Process p in javas) { if (p.MainWindowTitle.Equals("minecraft", StringComparison.CurrentCultureIgnoreCase)) { start = false; if (MessageBox.Show("Minecraft is allready running, do you want to close it before restarting. \r\nIf no minecraft will not start a second time.", "Minecraft is allready running", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { p.Kill(); start = true; } break; } } } if (start) { string param = ""; if (DataHolder.HasLoginInfo) { param += DataHolder.GetLoginInfo().GetName() + " " + DataHolder.GetLoginInfo().GetDecryptedPassword(); } if (checkBox1.Checked) { Directory.Delete(Data.minecraftbin, true); } else { } Process.Start(Data.minecraftexe, param); } }
private static void Main() { Data.CheckStartupFolders(); PluginLoader.LoadPlugins(); if (File.Exists(Data.logininfo)) { DataHolder.SetLoginInfo(LoginInfo.Load(Data.logininfo)); } DataHolder.SetBackups(BackupLoader.LoadBackups()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); BackupLoader.SaveBackups(DataHolder.GetBackups()); if (DataHolder.HasLoginInfo) { DataHolder.GetLoginInfo().Save(Data.logininfo); } else { File.Delete(Data.logininfo); } }
private static void Main() { //Init windows visuals Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Init data & load plugins Data.CheckStartupFolders(); PluginLoader.LoadPlugins(); DataHolder.LoadConfigs(); DataHolder.LoadImages(); //Check for updates if (!DataHolder.GetConfig().Has("autoupdate")) { DataHolder.GetConfig().Set("autoupdate", Plugin_API.Config.Type.Bool, false); } if ((bool)DataHolder.GetConfig().Get("autoupdate")) { Thread updateThread = new Thread(() => { Data.CheckForUpdate(); DataHolder.UpdatePlugins(); Data.PreformUpdate(); if (Data.updateData.ToString() != "") { DialogResult r = MessageBox.Show("New Update Available! Download?", "Update", MessageBoxButtons.YesNo); if (r == DialogResult.Yes) { Process.Start(Data.updaterExe); Thread.Sleep(100); Application.Exit(); } } }); updateThread.Start(); } if (File.Exists(Data.logininfo)) { DataHolder.SetLoginInfo(LoginInfo.Load(Data.logininfo)); } DataHolder.SetBackups(BackupLoader.LoadBackups()); //try //{ DataHolder.mainWindow = new MainWindow(); Application.Run(DataHolder.mainWindow); DataHolder.StopPlugins(); //} //catch (Exception ex) //{ // ErrorPage ep = new ErrorPage(ex.ToString()); // Application.Run(ep); //} BackupLoader.SaveBackups(DataHolder.GetBackups()); if (DataHolder.HasLoginInfo) { DataHolder.GetLoginInfo().Save(Data.logininfo); } else { if (File.Exists(Data.logininfo)) { File.Delete(Data.logininfo); } } DataHolder.SaveConfigs(); }