From 905df0a84b659ead7d3678875214568472472a96 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 6 Mar 2021 16:57:38 +0000 Subject: WinGui: Remove some dead code. --- .../HandBrakeWPF/Converters/OptionTabConverter.cs | 7 +--- win/CS/HandBrakeWPF/Services/UpdateService.cs | 5 --- win/CS/HandBrakeWPF/Utilities/UwpDetect.cs | 48 ---------------------- win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 2 - win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 2 - win/CS/HandBrakeWPF/Views/MainView.xaml | 4 +- 6 files changed, 4 insertions(+), 64 deletions(-) delete mode 100644 win/CS/HandBrakeWPF/Utilities/UwpDetect.cs (limited to 'win') diff --git a/win/CS/HandBrakeWPF/Converters/OptionTabConverter.cs b/win/CS/HandBrakeWPF/Converters/OptionTabConverter.cs index 069918a71..bc52652f4 100644 --- a/win/CS/HandBrakeWPF/Converters/OptionTabConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/OptionTabConverter.cs @@ -22,14 +22,11 @@ namespace HandBrakeWPF.Converters public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { OptionsTab[] tabs = value as OptionsTab[]; - if (tabs != null && (UwpDetect.IsUWP() || !Portable.IsUpdateCheckEnabled())) + if (tabs != null && !Portable.IsUpdateCheckEnabled()) { return tabs.Where(s => s != OptionsTab.Updates).ToArray(); } - - - - + return value; } diff --git a/win/CS/HandBrakeWPF/Services/UpdateService.cs b/win/CS/HandBrakeWPF/Services/UpdateService.cs index 693478acb..6acd16061 100644 --- a/win/CS/HandBrakeWPF/Services/UpdateService.cs +++ b/win/CS/HandBrakeWPF/Services/UpdateService.cs @@ -63,11 +63,6 @@ namespace HandBrakeWPF.Services /// public void PerformStartupUpdateCheck(Action callback) { - if (UwpDetect.IsUWP()) - { - return; // Disable Update checker if we are in a UWP container. - } - if (Portable.IsPortable() && !Portable.IsUpdateCheckEnabled()) { return; // Disable Update Check for Portable Mode. diff --git a/win/CS/HandBrakeWPF/Utilities/UwpDetect.cs b/win/CS/HandBrakeWPF/Utilities/UwpDetect.cs deleted file mode 100644 index 827b025d0..000000000 --- a/win/CS/HandBrakeWPF/Utilities/UwpDetect.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// -// -// Helper class to detect if we are running in a UWP container. -// https://msdn.microsoft.com/en-us/library/windows/desktop/hh446599(v=vs.85).aspx -// -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrakeWPF.Utilities -{ - using System; - using System.Runtime.InteropServices; - using System.Text; - - public class UwpDetect - { - [DllImport("kernel32.dll")] - static extern int GetCurrentPackageFullName(ref int length, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder fullName); - - private const int APPMODEL_ERROR_NO_PACKAGE = 15700; - - public static bool IsUWP() - { - if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor <= 1) - { - return false; - } - - int length = 0; - StringBuilder packageName = new StringBuilder(1024); - - int result = GetCurrentPackageFullName(ref length, packageName); // Only available in 6.2 or later. - if (result == APPMODEL_ERROR_NO_PACKAGE) - { - return false; - } - - if (packageName.ToString().Trim().Length > 0) - { - return true; - } - - return false; - } - } -} diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 9e9a49e4f..b335e1e2c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -748,8 +748,6 @@ namespace HandBrakeWPF.ViewModels } } - public bool IsUWP { get; } = UwpDetect.IsUWP(); - public string SourceInfo { get diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 817fb4041..941381156 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -138,8 +138,6 @@ namespace HandBrakeWPF.ViewModels public IAboutViewModel AboutViewModel { get; set; } - public bool IsUWP { get; } = UwpDetect.IsUWP(); - public bool IsNightly { get; } = HandBrakeVersionHelper.IsNightly(); public bool IsWindows10 => HandBrakeWPF.Utilities.SystemInfo.IsWindows10(); diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 15719c495..35e25bdec 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -135,8 +135,8 @@ - - + + -- cgit v1.2.3