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 string FileUploadDefaultDirectory = "";
public bool ShowUploadWarning = true; // First time upload warning public bool ShowUploadWarning = true; // First time upload warning
public bool ShowMultiUploadWarning = true; // More than 10 files 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 bool ShowTrayLeftClickTip = true; // Tray icon left click tip
public int NameParserAutoIncrementNumber = 0; public int NameParserAutoIncrementNumber = 0;
public RecentItem[] RecentLinks = null; 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.")] [Category("Application"), DefaultValue(10), Description("In recent links tray menu max how many links to show.")]
public int RecentLinksMaxCount { get; set; } 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.")] [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 long LargeFileSize { get; set; } public int LargeFileSizeWarning { get; set; }
[Category("Application"), DefaultValue(""), Description("URLs will open using this path instead of default browser. Example path: chrome.exe")] [Category("Application"), DefaultValue(""), Description("URLs will open using this path instead of default browser. Example path: chrome.exe")]
[Editor(typeof(ExeFileNameEditor), typeof(UITypeEditor))] [Editor(typeof(ExeFileNameEditor), typeof(UITypeEditor))]

View file

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