private void modSiteBox_TextChanged(object sender, EventArgs e) { if (selectedMod != null && !updatingFields) { selectedMod.website = modSiteBox.Text; selectedMod.UpdateModValues(); modListView.Items[selectedIndex].SubItems[1].Text = selectedMod.uriState; linkStatusLabel.Text = selectedMod.uriState; modDownloadBox.Text = selectedMod.dlSite; } }
private void DownloadFile() { SettingManager settings = new SettingManager(); string version = settings.minecraftVersionLoad; if (stuffIndex == 3) { if (!File.Exists(cd + "\\plugins\\TechnicLauncher.exe")) { WebClient client = new WebClient(); client.DownloadFileAsync(new Uri("http://launcher.technicpack.net/launcher4/308/TechnicLauncher.exe"), cd + "\\plugins\\TechnicLauncher.exe"); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); } else { taskDone = true; } return; } else if (stuffIndex == 4) { if (!File.Exists(cd + "\\plugins\\server_template\\RUN.bat")) { Directory.Delete(cd + "\\plugins\\server_template", true); Directory.CreateDirectory(cd + "\\plugins\\server_template"); Directory.CreateDirectory(cd + "\\temp"); WebClient client = new WebClient(); client.DownloadFileAsync(new Uri("https://dl.dropboxusercontent.com/u/46484032/TMC/ServerTemplate.zip"), cd + "\\temp\\server.zip"); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); } else { taskDone = true; } return; } else if (stuffIndex == 5) { if (version != "" && !File.Exists(cd + "\\plugins\\server_template\\minecraft_server." + version + ".jar")) { WebClient client = new WebClient(); client.DownloadFileAsync(new Uri("https://s3.amazonaws.com/Minecraft.Download/versions/" + version + "/minecraft_server." + version + ".jar"), cd + "\\plugins\\server_template\\minecraft_server." + version + ".jar"); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); } else { taskDone = true; } return; } else if (stuffIndex == 6) { if (!Directory.Exists(cd + "\\plugins\\client_template\\bin\\natives")) { Directory.CreateDirectory(cd + "\\temp"); WebClient client = new WebClient(); client.DownloadFileAsync(new Uri("https://dl.dropboxusercontent.com/u/46484032/TMC/ClientTemplate.zip"), cd + "\\temp\\client.zip"); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); } else { taskDone = true; } return; } else if (stuffIndex == 7) { if (version != "" && !File.Exists(cd + "\\plugins\\client_template\\bin\\minecraft.jar")) { WebClient client = new WebClient(); client.DownloadFileAsync(new Uri("https://s3.amazonaws.com/Minecraft.Download/versions/" + version + "/" + version + ".jar"), cd + "\\plugins\\client_template\\bin\\minecraft.jar"); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); } else { taskDone = true; } return; } else if (stuffIndex == 8) { if (version != "" && !File.Exists(cd + "\\plugins\\client_template\\bin\\" + version + ".json")) { WebClient client = new WebClient(); client.DownloadFileAsync(new Uri("https://s3.amazonaws.com/Minecraft.Download/versions/" + version + "/" + version + ".json"), cd + "\\plugins\\client_template\\bin\\" + version + ".json"); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); } else { taskDone = true; } return; } else if (stuffIndex == 9) { if (version != "" && Directory.GetFiles(cd + "\\plugins\\potionidhelper").Length == 0) { ModInfo pih = new ModInfo("potionidhelper.jar"); pih.website = "http://minecraft.curseforge.com/mc-mods/231384-potion-id-helper"; pih.UpdateModValues(); pih.CheckForUpdate(version); while (pih.checkBusy) { } WebClient client = new WebClient(); client.DownloadFileAsync(new Uri(pih.dlSite), cd + "\\plugins\\potionidhelper\\" + pih.newFileName); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); } else { taskDone = true; } return; } else if (stuffIndex == 10) { if (!coreExists) { foreach (string file in Directory.GetFiles(cd + "\\plugins\\potionidhelper")) { if (file.Contains("brandonscore")) { coreExists = true; break; } } } if (version != "" && !coreExists) { ModInfo bc = new ModInfo("brandonscore.jar"); bc.website = "http://minecraft.curseforge.com/mc-mods/231382-brandons-core"; bc.UpdateModValues(); bc.CheckForUpdate(version); while (bc.checkBusy) { } WebClient client = new WebClient(); client.DownloadFileAsync(new Uri(bc.dlSite), cd + "\\plugins\\potionidhelper\\" + bc.newFileName); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); } else { taskDone = true; } return; } }