private void DownloadMinecraft() { var downloads = Minecraft.GetDownloadLinks(); WebClient client = new WebClient(); SetProgressBoundsAsync(0, downloads.Count); UpdateProgressAsync(0); foreach (var fileDownload in downloads) { var directory = Path.GetDirectoryName(Path.Combine(Minecraft.DotMinecraft, fileDownload.Destination)); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } client.DownloadFile(fileDownload.DownloadUri.ToString(), Path.Combine(Minecraft.DotMinecraft, fileDownload.Destination)); UpdateProgressAsync(downloadingProgressBar.Value + 1); } Minecraft.ExpandNatives(); UpdateVersion = true; FinishUpdateAsync(); }
public Launcher() { CheckStructure(); InitializeComponent(); // Set up browsers newsWebBrowser.Navigate("http://mcupdate.tumblr.com"); mapsWebBrowser.Navigate("http://www.slreposervice.com/launcher/category/maps"); mapsWebBrowser.Navigating += repoWebBrowser_Navigating; UpdateVersion = false; // Populate username/password var login = Minecraft.GetLastLogin(); if (login != null) { usernameTextBox.Text = login.Username; passwordTextBox.Text = login.Password; rememberPasswordCheckBox.Checked = true; } WebClient client = new WebClient(); client.OpenReadCompleted += client_OpenReadCompleted; client.OpenReadAsync(new Uri("http://status.mojang.com/check")); GetJars(); }