public async Task <bool> UpdateIfNeeded(ProgressDialog dialog) { var tempFile = Path.GetTempFileName(); try { using (var client = new WebClient()) { client.DownloadProgressChanged += (sender, e) => dialog.Invoke(new Action(() => dialog.SetProgress(e.ProgressPercentage))); if (AvailableLocales.Count > 0) { client.Headers[HttpRequestHeader.IfNoneMatch] = string.Format("\"{0}\"", Settings.TranslationsBuild); } await client.DownloadFileTaskAsync(new Uri("https://dl.nul.sh/USBHelperLauncher/translations.zip?v=1"), tempFile); Settings.TranslationsBuild = client.ResponseHeaders[HttpResponseHeader.ETag].Trim('"'); Settings.Save(); } if (!Directory.Exists("locale")) { Directory.CreateDirectory("locale"); } using (var zip = ZipFile.OpenRead(tempFile)) { foreach (var entry in zip.Entries) { var fileName = Path.Combine("locale", entry.Name); entry.ExtractToFile(fileName, true); } } dirty = true; return(true); } catch (WebException e) when(((HttpWebResponse)e.Response)?.StatusCode == HttpStatusCode.NotModified) { return(false); } finally { File.Delete(tempFile); } }