public static string DownloadFile(string url, string destination, Action finishAction, bool isBackground = false) { string baseURL = GetBaseURL(url); if (baseURL != "") { url = baseURL; } string remote_filename = ""; if (url != "") { remote_filename = GetRemoteFileName(url); } string filename = "temp.zip"; if (remote_filename != "") { filename = remote_filename; } if (File.Exists($"{destination}\\{filename}")) { File.Delete($"{destination}\\{filename}"); } if (!Directory.Exists(destination)) { Directory.CreateDirectory(destination); } DownloadWindow downloadWindow = new DownloadWindow($"{Program.LanguageResource.GetString("Downloading")} \"{filename}\"", url, $"{destination}\\{filename}"); downloadWindow.DownloadCompleted = finishAction; if (isBackground) { downloadWindow.StartBackground(); } else { downloadWindow.Start(); } return(filename); }