diff --git a/GUI.NET/Dependencies/resources.en.xml b/GUI.NET/Dependencies/resources.en.xml index ce8924cf..2951b7d3 100644 --- a/GUI.NET/Dependencies/resources.en.xml +++ b/GUI.NET/Dependencies/resources.en.xml @@ -41,7 +41,7 @@ You are running the latest version of Mesen Patch and reset the current game? Please select a ROM matching the IPS patch file. - Unable to download file. Check your internet connection and try again. Details: + Unable to download file. Check your internet connection and try again. Details: {0} Mesen could not launch because it was unable to load MesenCore.dll due to missing dependencies. Mesen was unable to start due to missing files. Error: MesenCore.dll is missing. An unexpected error has occurred. Error details: {0} diff --git a/GUI.NET/Dependencies/resources.es.xml b/GUI.NET/Dependencies/resources.es.xml index e4f934cb..ee504dfe 100644 --- a/GUI.NET/Dependencies/resources.es.xml +++ b/GUI.NET/Dependencies/resources.es.xml @@ -531,7 +531,7 @@ Ya utiliza la versión mas reciente de Mesen. ¿Aplicar el parche y reiniciar el juego? Elija la ROM que corresponde al archivo IPS seleccionado. - No se puede descargar el archivo. Compruebe su conexión a Internet e inténtelo de nuevo. Detalles del error: + No se puede descargar el archivo. Compruebe su conexión a Internet e inténtelo de nuevo. Detalles del error: {0} Mesen no puede inciarse porque porque no puede cargar MesenCore.dll debido a dependencias no encontradas. Mesen no puede iniciarse debido a que faltan archivos. Error: No se encuentra el archivo MesenCore.dll. Se ha producido un error inesperado. Detalles del error: {0} diff --git a/GUI.NET/Dependencies/resources.fr.xml b/GUI.NET/Dependencies/resources.fr.xml index b3023b17..c1df61f3 100644 --- a/GUI.NET/Dependencies/resources.fr.xml +++ b/GUI.NET/Dependencies/resources.fr.xml @@ -545,7 +545,7 @@ Vous utilisez déjà la version la plus récente de Mesen. Appliquer la patch et faire un reset du jeu? Choisissez un ROM qui correspond au fichier IPS choisi. - Impossible de télécharger le fichier. Vérifier votre connexion internet et essayez à nouveau. Détails de l'erreur: + Impossible de télécharger le fichier. Vérifier votre connexion internet et essayez à nouveau. Détails de l'erreur: {0} Mesen n'a pas été en mesure de charger le fichier MesenCore.dll, et ne peut donc pas être lancé. Mesen est incapable de démarrer puisqu'il manque des fichiers. Erreur: Le fichier MesenCore.dll est introuvable. Une erreur inattendue s'est produite. Détails de l'erreur : {0} diff --git a/GUI.NET/Dependencies/resources.ja.xml b/GUI.NET/Dependencies/resources.ja.xml index 3297135b..d79d46ee 100644 --- a/GUI.NET/Dependencies/resources.ja.xml +++ b/GUI.NET/Dependencies/resources.ja.xml @@ -527,7 +527,7 @@ 既にMesenの最新のバージョンを使っています。 IPSパッチを当てて、ゲームをリセットしますか? IPSファイルに合うゲームファイルを選んでください。 - ファイルをダウンロードできませんでした。ネット接続を確認してから、再試行してください。 エラーの詳細: + ファイルをダウンロードできませんでした。ネット接続を確認してから、再試行してください。 エラーの詳細: {0} MesenはMesenCore.dllをロード出来なかったため、起動できませんでした。 必要なファイルはロード出来なかったため、Mesenは起動できません。 エラー: MesenCore.dllはロードできません。 予期しないエラーが発生しました。 エラーの詳細: {0} diff --git a/GUI.NET/Dependencies/resources.pt.xml b/GUI.NET/Dependencies/resources.pt.xml index a7d07b07..49cc38a0 100644 --- a/GUI.NET/Dependencies/resources.pt.xml +++ b/GUI.NET/Dependencies/resources.pt.xml @@ -531,7 +531,7 @@ Já utiliza a versão mais recente do Mesen. Aplicar o patch e reiniciar o jogo? Selecione a ROM que corresponde ao arquivo IPS selecionado. - Não foi possível baixar o arquivo. Verifique sua conexão com a internet e tente de novo. Detalhes do erro: + Não foi possível baixar o arquivo. Verifique sua conexão com a internet e tente de novo. Detalhes do erro: {0} Mesen não pode iniciar pois foi incapaz de carregar MesenCore.dll devido a falta de dependências. Mesen não pode iniciar devido a falta de arquivos. Erro: Não se encontra o arquivo MesenCore.dll. Houve um erro inesperado. Detalhes do erro: {0} diff --git a/GUI.NET/Dependencies/resources.ru.xml b/GUI.NET/Dependencies/resources.ru.xml index 7c098634..500a9dcd 100644 --- a/GUI.NET/Dependencies/resources.ru.xml +++ b/GUI.NET/Dependencies/resources.ru.xml @@ -536,7 +536,7 @@ Вы используете последнюю версию Mesen Пропатчить и сбросить текущую игру? Пожалуйста выберите ROM соответствующий IPS. - Невозможно загрузить файл. Проверьте ваше соединение с интернетом и попробуйте ещё раз. Подробно: + Невозможно загрузить файл. Проверьте ваше соединение с интернетом и попробуйте ещё раз. Подробно: {0} Mesen could not launch because it was unable to load MesenCore.dll due to missing dependencies. Mesen не может запуститься из за отсутствующих файлов. Ошибка: MesenCore.dll не найден. Неизвестная ошибка. Подробно: {0} diff --git a/GUI.NET/Dependencies/resources.uk.xml b/GUI.NET/Dependencies/resources.uk.xml index 798cc9ca..6bbdd6e1 100644 --- a/GUI.NET/Dependencies/resources.uk.xml +++ b/GUI.NET/Dependencies/resources.uk.xml @@ -535,7 +535,7 @@ Ви використовуєте останню версію Mesen Пропатчити і скинути поточну гру? Будь ласка, оберіть ROM відповідний IPS. - Неможливо завантажити файл. Перевірте ваше з'єднання з інтернетом і спробуйте ще раз. Детально: + Неможливо завантажити файл. Перевірте ваше з'єднання з інтернетом і спробуйте ще раз. Детально: {0} Mesen could not launch because it was unable to load MesenCore.dll due to missing dependencies. Mesen не може запуститися через відсутні файли. Помилка: MesenCore.dll не знайдений. Невідома помилка. Детально: {0} diff --git a/GUI.NET/Forms/frmDownloadProgress.cs b/GUI.NET/Forms/frmDownloadProgress.cs index dd643204..3752e9ea 100644 --- a/GUI.NET/Forms/frmDownloadProgress.cs +++ b/GUI.NET/Forms/frmDownloadProgress.cs @@ -46,44 +46,53 @@ namespace Mesen.GUI.Forms DialogResult result = System.Windows.Forms.DialogResult.None; - using(var client = new WebClient()) { - client.DownloadProgressChanged += (object s, DownloadProgressChangedEventArgs args) => { - progressDownload.Value = args.ProgressPercentage; - }; - client.DownloadFileCompleted += (object s, AsyncCompletedEventArgs args) => { - if(!args.Cancelled && args.Error == null && File.Exists(_filename)) { - result = System.Windows.Forms.DialogResult.OK; - } else if(args.Error != null) { - MesenMsgBox.Show("UnableToDownload", MessageBoxButtons.OK, MessageBoxIcon.Error, args.Error.ToString()); + Task.Run(() => { + using(var client = new WebClient()) { + client.DownloadProgressChanged += (object s, DownloadProgressChangedEventArgs args) => { + this.BeginInvoke((Action)(() => { + lblFilename.Text = string.Format("{0} ({1:0.00}Mb)", _link, (double)args.TotalBytesToReceive/1024/1024); + progressDownload.Value = args.ProgressPercentage; + })); + }; + client.DownloadFileCompleted += (object s, AsyncCompletedEventArgs args) => { + if(!args.Cancelled && args.Error == null && File.Exists(_filename)) { + result = System.Windows.Forms.DialogResult.OK; + } else if(args.Error != null) { + MesenMsgBox.Show("UnableToDownload", MessageBoxButtons.OK, MessageBoxIcon.Error, args.Error.ToString()); + result = System.Windows.Forms.DialogResult.Cancel; + } + }; + + Task downloadTask = null; + try { + downloadTask = client.DownloadFileTaskAsync(_link, _filename); + } catch(Exception ex) { + MesenMsgBox.Show("UnableToDownload", MessageBoxButtons.OK, MessageBoxIcon.Error, ex.ToString()); result = System.Windows.Forms.DialogResult.Cancel; } - }; - Task downloadTask = null; - try { - downloadTask = client.DownloadFileTaskAsync(_link, _filename); - } catch(Exception ex) { - MesenMsgBox.Show("UnableToDownload", MessageBoxButtons.OK, MessageBoxIcon.Error, ex.ToString()); - result = System.Windows.Forms.DialogResult.Cancel; - } + if(downloadTask == null) { + result = System.Windows.Forms.DialogResult.Cancel; + } else { + while(!downloadTask.IsCompleted && !_cancel) { + System.Threading.Thread.Sleep(200); + } - if(downloadTask == null) { - result = System.Windows.Forms.DialogResult.Cancel; - } else { - while(!downloadTask.IsCompleted && !_cancel) { - System.Threading.Thread.Sleep(200); - Application.DoEvents(); - } - - if(_cancel) { - client.CancelAsync(); - } else if(result == System.Windows.Forms.DialogResult.None) { - result = System.Windows.Forms.DialogResult.OK; + if(_cancel) { + client.CancelAsync(); + } else if(result == System.Windows.Forms.DialogResult.None) { + result = System.Windows.Forms.DialogResult.OK; + } } } - } - DialogResult = result; - this.Close(); + + //Wait a bit for the progress bar to update to 100% (display updates are slower than the .Value updates) + System.Threading.Thread.Sleep(500); + this.BeginInvoke((Action)(() => { + DialogResult = result; + this.Close(); + })); + }); } } }