public DownloadLWJGL(MainForm form, String path) { this.form = form; this.path = path; if (File.Exists(path + "natives.zip")) File.Delete(path + "natives.zip"); if (File.Exists(path + "lwjgl.jar")) File.Delete(path + "lwjgl.jar"); if (File.Exists(path + "jinput.jar")) File.Delete(path + "jinput.jar"); if (File.Exists(path + "lwjgl_util.jar")) File.Delete(path + "lwjgl_util.jar"); if (!Directory.Exists(path)) Directory.CreateDirectory(path); native = new Uri(downloadLink + "windows_natives.jar"); lwjgl = new Uri(downloadLink + "lwjgl.jar"); jinput = new Uri(downloadLink + "jinput.jar"); util = new Uri(downloadLink + "lwjgl_util.jar"); WebClient client = new WebClient(); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(form.SetProgressBar); //TODO: Don't use mainForm client.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(Downloaded); form.SetTask("Downloading Natives"); //TODO: ^ client.DownloadFileAsync(native, path + "natives.zip"); while (isDownloading) { Application.DoEvents(); } isDownloading = true; form.SetTask("Downloading LWJGL"); //TODO: ^ client.DownloadFileAsync(lwjgl, path + "lwjgl.jar"); while (isDownloading) { Application.DoEvents(); } isDownloading = true; form.SetTask("Downloading JInput"); //TODO: ^ client.DownloadFileAsync(jinput, path + "jinput.jar"); while (isDownloading) { Application.DoEvents(); } isDownloading = true; form.SetTask("Downloading LWJGL Util"); //TODO: ^ client.DownloadFileAsync(util, path + "jwjgl_util.jar"); while (isDownloading) { Application.DoEvents(); } }
public DownloadMods(MainForm form,String path, String downloadLink) { this.form = form; this.path = path; this.downloadLink = downloadLink; WebClient client = new WebClient(); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(form.SetProgressBar); client.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(Downloaded); client.DownloadFileAsync(new Uri(downloadLink), path + "modpack.zip"); while (isDownloading) { Application.DoEvents(); } }
public DownloadMinecraft(MainForm form, String version, String path) { this.URL = String.Format("http://assets.minecraft.net/{0}/minecraft.jar", version); this.form = form; this.version = version; this.path = path; if (!Directory.Exists(path)) Directory.CreateDirectory(path); WebClient client = new WebClient(); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(form.SetProgressBar); client.DownloadFileCompleted += new AsyncCompletedEventHandler(Downloaded); client.DownloadFileAsync(new Uri(URL), path + "minecraft.jar"); while (isDownloading) { Application.DoEvents(); } }