Skip to content

Commit

Permalink
Now showing an error dialog if it can't determine the filename of the…
Browse files Browse the repository at this point in the history
… update file. This resolves #589.
  • Loading branch information
ravibpatel committed Mar 31, 2023
1 parent 36b569c commit ee34a96
Show file tree
Hide file tree
Showing 34 changed files with 183 additions and 33 deletions.
8 changes: 4 additions & 4 deletions AutoUpdater.NET/AutoUpdater.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
<Company>RBSoft</Company>
<Product>AutoUpdater.NET</Product>
<Copyright>Copyright © 2012-2023 RBSoft</Copyright>
<Version>1.7.7.0</Version>
<AssemblyVersion>1.7.7.0</AssemblyVersion>
<FileVersion>1.7.7.0</FileVersion>
<Version>1.7.8.0</Version>
<AssemblyVersion>1.7.8.0</AssemblyVersion>
<FileVersion>1.7.8.0</FileVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>AutoUpdater.NET.snk</AssemblyOriginatorKeyFile>
<NeutralLanguage>en</NeutralLanguage>
<PackageId>Autoupdater.NET.Official</PackageId>
<IncludeSymbols>true</IncludeSymbols>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageVersion>1.7.7.0</PackageVersion>
<PackageVersion>1.7.8.0</PackageVersion>
<Title>AutoUpdater.NET</Title>
<Authors>rbsoft</Authors>
<Description>AutoUpdater.NET is a class library that allows .NET developers to easily add auto update functionality to their WinForms or WPF application projects.</Description>
Expand Down
21 changes: 13 additions & 8 deletions AutoUpdater.NET/DownloadUpdateDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,30 @@ private void WebClientOnDownloadFileCompleted(object sender, AsyncCompletedEvent
CompareChecksum(_tempFile, _args.CheckSum);
}

// try to parse the content disposition header if it exists
// Try to parse the content disposition header if it exists.
ContentDisposition contentDisposition = null;
try
if (!string.IsNullOrWhiteSpace(_webClient.ResponseHeaders?["Content-Disposition"]))
{
if (!string.IsNullOrWhiteSpace(_webClient.ResponseHeaders?["Content-Disposition"]))
try
{
contentDisposition = new ContentDisposition(_webClient.ResponseHeaders["Content-Disposition"]);
}
}
catch (FormatException)
{
// ignore content disposition header if it is wrongly formated
contentDisposition = null;
catch (FormatException)
{
// Ignore content disposition header if it is wrongly formatted.
contentDisposition = null;
}
}

var fileName = string.IsNullOrEmpty(contentDisposition?.FileName)
? Path.GetFileName(_webClient.ResponseUri.LocalPath)
: contentDisposition.FileName;

if (string.IsNullOrWhiteSpace(fileName))
{
throw new WebException(Resources.UnableToDetermineFilenameMessage);
}

var tempPath =
Path.Combine(
string.IsNullOrEmpty(AutoUpdater.DownloadPath) ? Path.GetTempPath() : AutoUpdater.DownloadPath,
Expand Down
2 changes: 1 addition & 1 deletion AutoUpdater.NET/DownloadUpdateDialog.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.Text" xml:space="preserve">
<value>Software Update</value>
<value>Software-Aktualisierung</value>
</data>
<data name="labelInformation.Text" xml:space="preserve">
<value>Update wird heruntergeladen...</value>
Expand Down
2 changes: 1 addition & 1 deletion AutoUpdater.NET/DownloadUpdateDialog.lv.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<data name="$this.Text" xml:space="preserve">
<value>Programmatūras atjauninājums</value>
</data>
<data name="labelinformation.Text" xml:space="preserve">
<data name="labelInformation.Text" xml:space="preserve">
<value>Lejupielādē atjauninājumu...</value>
</data>
</root>
2 changes: 1 addition & 1 deletion AutoUpdater.NET/DownloadUpdateDialog.pt-BR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<data name="$this.Text" xml:space="preserve">
<value>Atualização de software</value>
</data>
<data name="labelinformation.Text" xml:space="preserve">
<data name="labelInformation.Text" xml:space="preserve">
<value>Baixando a atualização...</value>
</data>
</root>
2 changes: 1 addition & 1 deletion AutoUpdater.NET/DownloadUpdateDialog.pt.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<data name="$this.Text" xml:space="preserve">
<value>Atualização de software</value>
</data>
<data name="labelinformation.Text" xml:space="preserve">
<data name="labelInformation.Text" xml:space="preserve">
<value>A transferir a atualização...</value>
</data>
</root>
9 changes: 9 additions & 0 deletions AutoUpdater.NET/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.ar.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="UpdateUnavailableMessage" xml:space="preserve">
<value>لا يوجد تحديث متاح. الرجاء معاودة المحاولة في وقت لاحق.</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>تعذر تحديد اسم ملف التحديث!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.cs.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Stahování na {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Nelze určit název souboru aktualizace!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.da.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Downloader ved {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Kan ikke bestemme filnavnet på opdateringsfilen!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Herunterladen bei {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Der Dateiname der Update-Datei kann nicht ermittelt werden!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Descargando a {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>¡No se puede determinar el nombre de archivo del archivo de actualización!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Téléchargement à {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Impossible de déterminer le nom de fichier du fichier de mise à jour !</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.it.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Download in {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Impossibile determinare il nome file del file di aggiornamento!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.ja-JP.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>{0}/秒でダウンロード中</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>更新ファイルのファイル名を特定できません!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.ko.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>{0}/s에서 다운로드 중</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>업데이트 파일의 파일 이름을 확인할 수 없습니다!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.lv.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Lejupielādē ar ātrumu {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Nevar noteikt atjaunināšanas faila nosaukumu!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.nl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Downloaden op {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Kan de bestandsnaam van het updatebestand niet bepalen!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.pl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Szybkość pobierania: {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Nie można określić nazwy pliku aktualizacji!</value>
</data>
</root>
5 changes: 4 additions & 1 deletion AutoUpdater.NET/Properties/Resources.pt-BR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<value>Falha ao verificar atualização</value>
</data>
<data name="HashAlgorithmNotSupportedMessage" xml:space="preserve">
<value>Hash algorithm provided in the XML file is not supported.</value>
<value>O algoritmo de hash fornecido no arquivo XML não é compatível.</value>
</data>
<data name="HashAlgorithmNotSupportedCaption" xml:space="preserve">
<value>Algoritmo de hash não suportado.</value>
Expand All @@ -145,4 +145,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Baixando a {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Não foi possível determinar o nome do arquivo de atualização!</value>
</data>
</root>
44 changes: 44 additions & 0 deletions AutoUpdater.NET/Properties/Resources.pt.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Baixando em {0}/s</value>
</data>
<data name="FileIntegrityCheckFailedCaption" xml:space="preserve">
<value>Soma de verificação difere</value>
</data>
<data name="FileIntegrityCheckFailedMessage" xml:space="preserve">
<value>A verificação da integridade do arquivo falhou e relatou alguns erros.</value>
</data>
<data name="HashAlgorithmNotSupportedCaption" xml:space="preserve">
<value>Algoritmo de Hash Não Suportado</value>
</data>
<data name="HashAlgorithmNotSupportedMessage" xml:space="preserve">
<value>O algoritmo de hash fornecido no arquivo XML não é suportado.</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Não foi possível determinar o nome do arquivo de atualização!</value>
</data>
<data name="UpdateCheckFailedCaption" xml:space="preserve">
<value>Falha na verificação de atualização</value>
</data>
<data name="UpdateCheckFailedMessage" xml:space="preserve">
<value>Há um problema ao acessar o servidor de atualização. Verifique sua conexão com a Internet e tente novamente mais tarde.</value>
</data>
<data name="UpdateUnavailableCaption" xml:space="preserve">
<value>Atualização indisponível</value>
</data>
<data name="UpdateUnavailableMessage" xml:space="preserve">
<value>Não há atualização disponível. Por favor, tente novamente mais tarde.</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Downloading at {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Unable to determine the filename of the update file!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Загрузка на {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Невозможно определить имя файла обновления!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.sk.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Sťahovanie na {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Nie je možné určiť názov súboru aktualizácie!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.sv.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>Nedladdning vid {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Det går inte att bestämma filnamnet på uppdateringsfilen!</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.th.resx
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>กำลังดาวน์โหลด ด้วยความเร็ว {0}/s</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>ไม่สามารถระบุชื่อไฟล์ของไฟล์อัพเดตได้!</value>
</data>
</root>
44 changes: 44 additions & 0 deletions AutoUpdater.NET/Properties/Resources.tr.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>{0}/sn hızında indiriliyor</value>
</data>
<data name="FileIntegrityCheckFailedCaption" xml:space="preserve">
<value>Sağlama toplamı farklıdır</value>
</data>
<data name="FileIntegrityCheckFailedMessage" xml:space="preserve">
<value>Dosya bütünlüğü denetimi başarısız oldu ve bazı hatalar bildirdi.</value>
</data>
<data name="HashAlgorithmNotSupportedCaption" xml:space="preserve">
<value>Desteklenmeyen Hash Algoritması</value>
</data>
<data name="HashAlgorithmNotSupportedMessage" xml:space="preserve">
<value>XML dosyasında sağlanan karma algoritma desteklenmiyor.</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>Güncelleme dosyasının dosya adı belirlenemiyor!</value>
</data>
<data name="UpdateCheckFailedCaption" xml:space="preserve">
<value>Güncelleme Kontrolü Başarısız</value>
</data>
<data name="UpdateCheckFailedMessage" xml:space="preserve">
<value>Güncelleme sunucusuna erişirken bir sorun oluştu. Lütfen internet bağlantınızı kontrol edin ve daha sonra tekrar deneyin.</value>
</data>
<data name="UpdateUnavailableCaption" xml:space="preserve">
<value>Güncelleme Kullanılamıyor</value>
</data>
<data name="UpdateUnavailableMessage" xml:space="preserve">
<value>Mevcut bir güncelleme yok. Lütfen daha sonra tekrar deneyiniz.</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AutoUpdater.NET/Properties/Resources.zh.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="DownloadSpeedMessage" xml:space="preserve">
<value>以{0}/s下载</value>
</data>
<data name="UnableToDetermineFilenameMessage" xml:space="preserve">
<value>无法确定更新文件的文件名!</value>
</data>
</root>
3 changes: 0 additions & 3 deletions AutoUpdater.NET/RemindLaterForm.pl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@
<data name="labelDescription.Text" xml:space="preserve">
<value>Zaleca się pobranie aktualizacji już teraz. Ten proces może potrwać kilka minut, w zależności od szybkości połączenia internetowego, i zapewnia, że masz najnowszą wersję programu.</value>
</data>
<data name="buttonOK.Text" xml:space="preserve">
<value>OK</value>
</data>
<data name="labelTitle.Text" xml:space="preserve">
<value>Czy chcesz pobrać aktualizacje później?</value>
</data>
Expand Down
Loading

0 comments on commit ee34a96

Please sign in to comment.