Skip to content

Commit

Permalink
Improve downloader progress text
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaex committed May 5, 2024
1 parent 47bc35b commit ff15620
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 25 deletions.
44 changes: 30 additions & 14 deletions ShareX.HelpersLib/Properties/Resources.Designer.cs

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

20 changes: 12 additions & 8 deletions ShareX.HelpersLib/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,6 @@ Would you like to download it?</value>
<data name="MyPictureBox_LoadImageAsync_Loading_image___" xml:space="preserve">
<value>Loading image...</value>
</data>
<data name="DownloaderForm_ChangeProgress_Progress" xml:space="preserve">
<value>Progress: {0:0.0}%
Download speed: {1:0.0} KB/s
File size: {2:n0} / {3:n0} KB</value>
</data>
<data name="HotkeyType_LastRegion" xml:space="preserve">
<value>Capture last region</value>
</data>
Expand Down Expand Up @@ -645,7 +640,7 @@ Would you like to download and install it?</value>
<value>Save thumbnail image to file</value>
</data>
<data name="DownloaderForm_StartDownload_Downloading_" xml:space="preserve">
<value>Downloading.</value>
<value>Downloading...</value>
</data>
<data name="RegionCaptureAction_RemoveShapeCancelCapture" xml:space="preserve">
<value>Remove shape or cancel capture</value>
Expand Down Expand Up @@ -705,7 +700,7 @@ Would you like to download and install it?</value>
<value>Process name of window</value>
</data>
<data name="DownloaderForm_DownloaderForm_Waiting_" xml:space="preserve">
<value>Waiting.</value>
<value>Waiting...</value>
</data>
<data name="HotkeyType_ImageEditor" xml:space="preserve">
<value>Image editor</value>
Expand Down Expand Up @@ -861,7 +856,7 @@ Would you like to download and install it?</value>
<value>Capture active monitor</value>
</data>
<data name="DownloaderForm_StartDownload_Getting_file_size_" xml:space="preserve">
<value>Getting file size.</value>
<value>Getting file size...</value>
</data>
<data name="HotkeyType_Category_Other" xml:space="preserve">
<value>Other</value>
Expand Down Expand Up @@ -1295,4 +1290,13 @@ Would you like to download and install it?</value>
<data name="UpdateChannel_Release" xml:space="preserve">
<value>Release</value>
</data>
<data name="DownloaderForm_FileDownloader_ProgressChanged_Progress" xml:space="preserve">
<value>Progress</value>
</data>
<data name="DownloaderForm_FileDownloader_ProgressChanged_DownloadSpeed" xml:space="preserve">
<value>Download speed</value>
</data>
<data name="DownloaderForm_FileDownloader_ProgressChanged_FileSize" xml:space="preserve">
<value>File size</value>
</data>
</root>
7 changes: 4 additions & 3 deletions ShareX.HelpersLib/UpdateChecker/DownloaderForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
using ShareX.HelpersLib.Properties;
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -251,8 +250,10 @@ private void FileDownloader_ProgressChanged()
if (fileDownloader != null)
{
pbProgress.Value = (int)Math.Round(fileDownloader.DownloadPercentage);
lblProgress.Text = Helpers.SafeStringFormat(CultureInfo.CurrentCulture, Resources.DownloaderForm_ChangeProgress_Progress,
fileDownloader.DownloadPercentage, fileDownloader.DownloadSpeed / 1024, fileDownloader.DownloadedSize / 1024, fileDownloader.FileSize / 1024);

lblProgress.Text = $@"{Resources.DownloaderForm_FileDownloader_ProgressChanged_Progress}: {fileDownloader.DownloadPercentage:0.0}%
{Resources.DownloaderForm_FileDownloader_ProgressChanged_DownloadSpeed}: {((long)fileDownloader.DownloadSpeed).ToSizeString()}/s
{Resources.DownloaderForm_FileDownloader_ProgressChanged_FileSize}: {fileDownloader.DownloadedSize.ToSizeString()} / {fileDownloader.FileSize.ToSizeString()}";
}
}

Expand Down

0 comments on commit ff15620

Please sign in to comment.