mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
Changed registry check to be only performed once on startup
This commit is contained in:
parent
feedbe6ce4
commit
c9c9615669
3 changed files with 20 additions and 9 deletions
|
@ -319,5 +319,11 @@ public int HotkeyRepeatLimit
|
|||
public List<Color> RecentColors = new List<Color>();
|
||||
|
||||
#endregion Color Picker Form
|
||||
|
||||
#region Formless
|
||||
|
||||
public bool UploadForbidden = false;
|
||||
|
||||
#endregion Formless
|
||||
}
|
||||
}
|
|
@ -115,6 +115,7 @@ private static string HotkeysConfigFilePath
|
|||
public static void LoadInitialSettings()
|
||||
{
|
||||
LoadApplicationConfig();
|
||||
LoadUploadForbiddenRegistry();
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
|
@ -173,6 +174,18 @@ private static void Settings_SettingsSaveFailed(Exception e)
|
|||
settingsSaveFailWarningCount++;
|
||||
}
|
||||
|
||||
private static void LoadUploadForbiddenRegistry()
|
||||
{
|
||||
try
|
||||
{
|
||||
Settings.UploadForbidden = RegistryHelpers.CheckRegistry("SOFTWARE\\ShareX", "UploadForbidden", "true", Microsoft.Win32.RegistryHive.LocalMachine);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadUploadersConfig(bool fallbackSupport = true)
|
||||
{
|
||||
UploadersConfig = UploadersConfig.Load(UploadersConfigFilePath, BackupFolder, fallbackSupport);
|
||||
|
|
|
@ -1797,15 +1797,7 @@ public static void ShowNotificationTip(string text, string title = "ShareX", int
|
|||
|
||||
public static bool IsUploadAllowed()
|
||||
{
|
||||
bool isDisabled = false;
|
||||
try {
|
||||
isDisabled = RegistryHelpers.CheckRegistry("SOFTWARE\\ShareX", "DisableUpload", "true", Microsoft.Win32.RegistryHive.LocalMachine);
|
||||
}
|
||||
catch(Exception e) {
|
||||
DebugHelper.WriteException(e);
|
||||
}
|
||||
|
||||
if (isDisabled)
|
||||
if (Program.Settings.UploadForbidden)
|
||||
{
|
||||
MessageBox.Show(Resources.YourSystemAdminDisabledTheUploadFeature, "ShareX",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
|
Loading…
Reference in a new issue