From: sr55 Date: Mon, 23 Apr 2018 20:21:20 +0000 (+0100) Subject: WinGui: Portable Mode: New option to disable startup update check. X-Git-Tag: 1.2.0~502 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=128041edb0a8183bb4b27d906e31df4e3dfc32f4;p=handbrake WinGui: Portable Mode: New option to disable startup update check. --- diff --git a/win/CS/HandBrakeWPF/Services/UpdateService.cs b/win/CS/HandBrakeWPF/Services/UpdateService.cs index b5213f05d..c0a1bcab6 100644 --- a/win/CS/HandBrakeWPF/Services/UpdateService.cs +++ b/win/CS/HandBrakeWPF/Services/UpdateService.cs @@ -68,6 +68,11 @@ namespace HandBrakeWPF.Services return; // Disable Update checker if we are in a UWP container. } + if (Portable.IsPortable() && !Portable.IsUpdateCheckEnabled()) + { + return; // Disable Update Check for Portable Mode. + } + // Make sure it's running on the calling thread if (this.userSettingService.GetUserSetting(UserSettingConstants.UpdateStatus)) { diff --git a/win/CS/HandBrakeWPF/Utilities/Portable.cs b/win/CS/HandBrakeWPF/Utilities/Portable.cs index c2dcb6f3e..243f8e5f2 100644 --- a/win/CS/HandBrakeWPF/Utilities/Portable.cs +++ b/win/CS/HandBrakeWPF/Utilities/Portable.cs @@ -117,6 +117,22 @@ namespace HandBrakeWPF.Utilities return storagePath; } + public static bool IsUpdateCheckEnabled() + { + if (keyPairs.ContainsKey("update.check")) + { + string updateCheckEnabled = keyPairs["update.check"]; + if (!string.IsNullOrEmpty(updateCheckEnabled) && updateCheckEnabled.Trim() == "true") + { + return true; + } + + return false; + } + + return true; + } + /// /// The get temp directory. /// diff --git a/win/CS/HandBrakeWPF/portable.ini.template b/win/CS/HandBrakeWPF/portable.ini.template index 4c62e6e21..495a73441 100644 --- a/win/CS/HandBrakeWPF/portable.ini.template +++ b/win/CS/HandBrakeWPF/portable.ini.template @@ -5,10 +5,12 @@ # - Rename this file to portable.ini to activate feature. # - storage.dir => Stores Presets, Settings and Log Files. # - tmp.dir => temporary files only. (i.e Preview images) +# - update.check => true | false (enabled / disabled, default disabled for portable) # # Set to 'cwd' to use the current applications directory. It will automatically create "storage" and "tmp" folders in this instance. # Leave blank to use the system "TMP" directory and the "AppData" user profile folder. ################################# storage.dir = cwd -tmp.dir = cwd \ No newline at end of file +tmp.dir = cwd +update.check = false \ No newline at end of file