LargeFileSizeWarning uses MB or MiB

This commit is contained in:
Michael Delpach 2015-08-15 07:35:33 +08:00
parent 557d375309
commit 9ecbf3c30f
2 changed files with 14 additions and 11 deletions

View file

@ -40,7 +40,6 @@ public class ApplicationConfig : SettingsBase<ApplicationConfig>
public string FileUploadDefaultDirectory = "";
public bool ShowUploadWarning = true; // First time upload warning
public bool ShowMultiUploadWarning = true; // More than 10 files upload warning
public bool ShowLargeFileUploadWarning = true;
public bool ShowTrayLeftClickTip = true; // Tray icon left click tip
public int NameParserAutoIncrementNumber = 0;
public RecentItem[] RecentLinks = null;
@ -152,8 +151,8 @@ public ApplicationConfig()
[Category("Application"), DefaultValue(10), Description("In recent links tray menu max how many links to show.")]
public int RecentLinksMaxCount { get; set; }
[Category("Application"), DefaultValue(104857600), Description("Large file size defined in bytes. ShareX will warn before uploading large files. 0 disables this feature.")]
public long LargeFileSize { get; set; }
[Category("Application"), DefaultValue(100), Description("Large file size defined in MiB or MB. ShareX will warn before uploading large files. 0 disables this feature.")]
public int LargeFileSizeWarning { get; set; }
[Category("Application"), DefaultValue(""), Description("URLs will open using this path instead of default browser. Example path: chrome.exe")]
[Editor(typeof(ExeFileNameEditor), typeof(UITypeEditor))]

View file

@ -311,16 +311,20 @@ private void DoUploadJob()
Stop();
}
if (Program.Settings.LargeFileSize != 0 && Data.Length > Program.Settings.LargeFileSize)
if (Program.Settings.LargeFileSizeWarning != 0)
{
using (MyMessageBox msgbox = new MyMessageBox(
"You are attempting to upload a large file.\n\nAre you sure you want to continue?",
Application.ProductName,
MessageBoxButtons.YesNo, Resources.UploadManager_IsUploadConfirmed_Don_t_show_this_message_again_))
long dataSize = Program.Settings.BinaryUnits ? Program.Settings.LargeFileSizeWarning * 1024 * 1024 : Program.Settings.LargeFileSizeWarning * 1000 * 1000;
if (Data != null && Data.Length > dataSize)
{
msgbox.ShowDialog();
Program.Settings.ShowLargeFileUploadWarning = !msgbox.IsChecked;
if (msgbox.DialogResult == DialogResult.No) Stop();
using (MyMessageBox msgbox = new MyMessageBox(
"You are attempting to upload a large file.\n\nAre you sure you want to continue?",
Application.ProductName,
MessageBoxButtons.YesNo, Resources.UploadManager_IsUploadConfirmed_Don_t_show_this_message_again_))
{
msgbox.ShowDialog();
if (msgbox.IsChecked) Program.Settings.LargeFileSizeWarning = 0;
if (msgbox.DialogResult == DialogResult.No) Stop();
}
}
}