diff --git a/SophiApp/SophiApp/Customisations/CustomisationConstants.cs b/SophiApp/SophiApp/Customisations/CustomisationConstants.cs index 12044c7f..cef42190 100644 --- a/SophiApp/SophiApp/Customisations/CustomisationConstants.cs +++ b/SophiApp/SophiApp/Customisations/CustomisationConstants.cs @@ -116,6 +116,10 @@ internal static class CustomisationConstants internal const byte _261_DISABLED_VALUE = 1; internal const string _261_DISALLOW_WINDOWS_SHAKE = "DisallowShaking"; internal const byte _261_ENABLED_VALUE = 0; + internal const int _263_MIN_SUPPORTED_VERSION = 22509; + internal const byte _266_DISABLED_VALUE = 1; + internal const string _266_HIDE_ADDED_APPS = "HideRecentlyAddedApps"; + internal const string _267_APP_SUGGESTIONS = "SubscribedContent-338388Enabled"; internal const byte _302_STORAGE_POLICY_MONTH_VALUE = 30; internal const string _304_STORAGE_POLICY_04 = "04"; internal const byte _305_ENABLED_VALUE = 1; @@ -211,9 +215,6 @@ internal static class CustomisationConstants internal const string _349_VC_REDISTRX64_UNINSTALL_ARGS = "/uninstall /passive /norestart"; internal const string _349_VC_VERSION_URL = "https://raw.githubusercontent.com/aaronparker/vcredist/main/VcRedist/VisualCRedistributables.json"; internal const string _349_VERSION_NAME = "Version"; - internal const byte _400_DISABLED_VALUE = 1; - internal const string _400_HIDE_ADDED_APPS = "HideRecentlyAddedApps"; - internal const string _401_APP_SUGGESTIONS = "SubscribedContent-338388Enabled"; internal const string _500_ADGUARD_LINK = "https://store.rg-adguard.net/api/GetFiles"; internal const string _500_HEVC_APPX_NAME = "Microsoft.HEVCVideoExtension_x64__8wekyb3d8bbwe.Appx"; internal const string _500_HEVC_LINK = "https://github.com/Sophia-Community/SophiApp/raw/master/AppX/Microsoft.HEVCVideoExtension_x64__8wekyb3d8bbwe.Appx"; @@ -656,6 +657,10 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow) internal const string SIUF_PATH = @"SOFTWARE\Microsoft\Siuf\Rules"; internal const string SIUF_PERIOD = "NumberOfSIUFInPeriod"; internal const string SOPHIA_SCRIPT_SCHEDULED_PATH = "Sophia Script"; + internal const string START_LAYOUT = "Start_Layout"; + internal const byte START_LAYOUT_DEFAULT_VALUE = 0; + internal const byte START_LAYOUT_PINS_VALUE = 1; + internal const byte START_LAYOUT_RECOMMENDATIONS_VALUE = 2; internal const string START_PANEL_EXPLORER_PATH = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"; internal const string STARTUP_PAGE = "StartupPage"; internal const byte STARTUP_PAGE_CATEGORY_VALUE = 0; @@ -691,9 +696,9 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow) internal const string X64 = "x64"; internal static readonly string _203_WIN10_EXPLORER_INPROC_PATH = $@"{_203_WIN10_EXPLORER_PATH}\InprocServer32"; internal static readonly DateTime _21_PM_TASK_START = DateTime.Today.AddHours(21); + internal static readonly string _268_POWERSHELL_LNK = $@"{Environment.GetEnvironmentVariable("APPDATA")}\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk"; internal static readonly string _315_DELIVERY_OPT_PATH = $@"{Environment.GetEnvironmentVariable("SystemRoot")}\SoftwareDistribution\DeliveryOptimization"; internal static readonly string _348_INSTALLER_PATH = $@"{Environment.GetEnvironmentVariable("SystemRoot")}\Installer"; - internal static readonly string _402_POWERSHELL_LNK = $@"{Environment.GetEnvironmentVariable("APPDATA")}\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk"; internal static readonly Dictionary _500_ADGUARD_WEB_PARAMS = new Dictionary() { diff --git a/SophiApp/SophiApp/Customisations/CustomisationOs.cs b/SophiApp/SophiApp/Customisations/CustomisationOs.cs index 771144aa..8eddd8b5 100644 --- a/SophiApp/SophiApp/Customisations/CustomisationOs.cs +++ b/SophiApp/SophiApp/Customisations/CustomisationOs.cs @@ -530,6 +530,50 @@ public static void _261(bool IsChecked) => RegHelper.SetValue(RegistryHive.Curre : _261_DISABLED_VALUE, RegistryValueKind.DWord); + public static void _263(bool _) => RegHelper.SetValue(RegistryHive.CurrentUser, + ADVANCED_EXPLORER_PATH, + START_LAYOUT, + START_LAYOUT_DEFAULT_VALUE); + + public static void _264(bool _) => RegHelper.SetValue(RegistryHive.CurrentUser, + ADVANCED_EXPLORER_PATH, + START_LAYOUT, + START_LAYOUT_PINS_VALUE); + + public static void _265(bool _) => RegHelper.SetValue(RegistryHive.CurrentUser, + ADVANCED_EXPLORER_PATH, + START_LAYOUT, + START_LAYOUT_RECOMMENDATIONS_VALUE); + + public static void _266(bool IsChecked) + { + if (IsChecked) + { + RegHelper.DeleteKey(RegistryHive.LocalMachine, POLICIES_EXPLORER_PATH, _266_HIDE_ADDED_APPS); + return; + } + + RegHelper.SetValue(RegistryHive.LocalMachine, POLICIES_EXPLORER_PATH, _266_HIDE_ADDED_APPS, _266_DISABLED_VALUE, RegistryValueKind.DWord); + } + + public static void _267(bool IsChecked) + { + if (IsChecked) + { + RegHelper.SetValue(RegistryHive.CurrentUser, CONTENT_DELIVERY_MANAGER_PATH, _267_APP_SUGGESTIONS, ENABLED_VALUE, RegistryValueKind.DWord); + return; + } + + RegHelper.SetValue(RegistryHive.CurrentUser, CONTENT_DELIVERY_MANAGER_PATH, _267_APP_SUGGESTIONS, DISABLED_VALUE, RegistryValueKind.DWord); + } + + public static void _268(bool IsChecked) + { + var bytes = File.ReadAllBytes(_268_POWERSHELL_LNK); + bytes[0x15] = (byte)(IsChecked ? bytes[0x15] | 0x20 : bytes[0x15] ^ 0x20); + File.WriteAllBytes(_268_POWERSHELL_LNK, bytes); + } + public static void _300(bool IsChecked) => RegHelper.SetValue(RegistryHive.CurrentUser, STORAGE_POLICY_PATH, STORAGE_POLICY_01, @@ -907,35 +951,6 @@ public static void _355(bool _) } } - public static void _400(bool IsChecked) - { - if (IsChecked) - { - RegHelper.DeleteKey(RegistryHive.LocalMachine, POLICIES_EXPLORER_PATH, _400_HIDE_ADDED_APPS); - return; - } - - RegHelper.SetValue(RegistryHive.LocalMachine, POLICIES_EXPLORER_PATH, _400_HIDE_ADDED_APPS, _400_DISABLED_VALUE, RegistryValueKind.DWord); - } - - public static void _401(bool IsChecked) - { - if (IsChecked) - { - RegHelper.SetValue(RegistryHive.CurrentUser, CONTENT_DELIVERY_MANAGER_PATH, _401_APP_SUGGESTIONS, ENABLED_VALUE, RegistryValueKind.DWord); - return; - } - - RegHelper.SetValue(RegistryHive.CurrentUser, CONTENT_DELIVERY_MANAGER_PATH, _401_APP_SUGGESTIONS, DISABLED_VALUE, RegistryValueKind.DWord); - } - - public static void _402(bool IsChecked) - { - var bytes = File.ReadAllBytes(_402_POWERSHELL_LNK); - bytes[0x15] = (byte)(IsChecked ? bytes[0x15] | 0x20 : bytes[0x15] ^ 0x20); - File.WriteAllBytes(_402_POWERSHELL_LNK, bytes); - } - public static void _500(bool IsChecked) { if (IsChecked) diff --git a/SophiApp/SophiApp/Customisations/CustomisationStatus.cs b/SophiApp/SophiApp/Customisations/CustomisationStatus.cs index 07f10986..7cdc8a1e 100644 --- a/SophiApp/SophiApp/Customisations/CustomisationStatus.cs +++ b/SophiApp/SophiApp/Customisations/CustomisationStatus.cs @@ -253,6 +253,20 @@ public static bool _259() => RegHelper.GetNullableIntValue(RegistryHive.CurrentU public static bool _261() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, ADVANCED_EXPLORER_PATH, _261_DISALLOW_WINDOWS_SHAKE) != ENABLED_VALUE; + public static bool _263() => OsHelper.GetVersion().Build >= _263_MIN_SUPPORTED_VERSION + ? RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, ADVANCED_EXPLORER_PATH, START_LAYOUT) == START_LAYOUT_DEFAULT_VALUE + : throw new WindowsEditionNotSupportedException(); + + public static bool _264() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, ADVANCED_EXPLORER_PATH, START_LAYOUT) == START_LAYOUT_PINS_VALUE; + + public static bool _265() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, ADVANCED_EXPLORER_PATH, START_LAYOUT) == START_LAYOUT_RECOMMENDATIONS_VALUE; + + public static bool _266() => RegHelper.GetNullableIntValue(RegistryHive.LocalMachine, POLICIES_EXPLORER_PATH, _266_HIDE_ADDED_APPS) != _266_DISABLED_VALUE; + + public static bool _267() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, CONTENT_DELIVERY_MANAGER_PATH, _267_APP_SUGGESTIONS) == ENABLED_VALUE; + + public static bool _268() => (File.ReadAllBytes(_268_POWERSHELL_LNK)[0x15] == 2).Invert(); + public static bool _300() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, STORAGE_POLICY_PATH, STORAGE_POLICY_01) .HasNullOrValue(DISABLED_VALUE) .Invert(); @@ -429,12 +443,6 @@ public static bool _355() => VisualRedistrLibsHelper.IsInstalled() ? false : throw new VisualRedistrLibsNotInstalled(); - public static bool _400() => RegHelper.GetNullableIntValue(RegistryHive.LocalMachine, POLICIES_EXPLORER_PATH, _400_HIDE_ADDED_APPS) != _400_DISABLED_VALUE; - - public static bool _401() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, CONTENT_DELIVERY_MANAGER_PATH, _401_APP_SUGGESTIONS) == ENABLED_VALUE; - - public static bool _402() => (File.ReadAllBytes(_402_POWERSHELL_LNK)[0x15] == 2).Invert(); - public static bool _500() => HttpHelper.IsOnline ? UwpHelper.PackageExist(UWP_MS_WIN_PHOTOS) ? UwpHelper.PackageExist(_500_UWP_HEVC_VIDEO) diff --git a/SophiApp/SophiApp/Resources/UIData.json b/SophiApp/SophiApp/Resources/UIData.json index 24f828c8..c243eef0 100644 --- a/SophiApp/SophiApp/Resources/UIData.json +++ b/SophiApp/SophiApp/Resources/UIData.json @@ -1949,6 +1949,72 @@ "Windows10Supported": false, "Windows11Supported": true }, + { + "Id": 266, + "Header": { + "EN": "Show recently added apps in the Start menu", + "RU": "Показывать недавно добавленные приложения в меню \"Пуск\"", + "DE": "Zuletzt hinzugefügte Apps im Startmenü anzeigen", + "UA": "Відображати нещодавно додані додатки в меню \"Пуск\"", + "IT": "Mostra app aggiunte di recente nel menu Start" + }, + "Description": { + "EN": "", + "RU": "", + "DE": "", + "UA": "", + "IT": "" + }, + "Type": "CheckBox", + "Tag": "StartMenu", + "ViewId": 266, + "Windows10Supported": true, + "Windows11Supported": false + }, + { + "Id": 267, + "Header": { + "EN": "Show app suggestions in the Start menu", + "RU": "Показывать рекомендации в меню \"Пуск\"", + "DE": "App-Vorschläge im Startmenü anzeigen", + "UA": "Відображати рекомендації в меню \"Пуск\"", + "IT": "Mostra suggerimenti app nel menu Start" + }, + "Description": { + "EN": "", + "RU": "", + "DE": "", + "UA": "", + "IT": "" + }, + "Type": "CheckBox", + "Tag": "StartMenu", + "ViewId": 267, + "Windows10Supported": true, + "Windows11Supported": false + }, + { + "Id": 268, + "Header": { + "EN": "Run the Windows PowerShell shortcut from the Start menu as Administrator", + "RU": "Запускать ярлык Windows PowerShell в меню \"Пуск\" от имени Администратора", + "DE": "Windows PowerShell als Administrator im Startmenü ausführen", + "UA": "Запускати ярлик Windows PowerShell у меню \"Пуск\" від імені Адміністратора", + "IT": "Eseguire il collegamento di Windows PowerShell dal menu Start come amministratore" + }, + "Description": { + "EN": "", + "RU": "", + "DE": "", + "UA": "", + "IT": "" + }, + "Type": "CheckBox", + "Tag": "StartMenu", + "ViewId": 268, + "Windows10Supported": true, + "Windows11Supported": true + }, { "Id": 300, "Header": { @@ -3059,72 +3125,6 @@ "Windows10Supported": true, "Windows11Supported": true }, - { - "Id": 400, - "Header": { - "EN": "Show recently added apps in the Start menu", - "RU": "Показывать недавно добавленные приложения в меню \"Пуск\"", - "DE": "Zuletzt hinzugefügte Apps im Startmenü anzeigen", - "UA": "Відображати нещодавно додані додатки в меню \"Пуск\"", - "IT": "Mostra app aggiunte di recente nel menu Start" - }, - "Description": { - "EN": "", - "RU": "", - "DE": "", - "UA": "", - "IT": "" - }, - "Type": "CheckBox", - "Tag": "StartMenu", - "ViewId": 400, - "Windows10Supported": true, - "Windows11Supported": false - }, - { - "Id": 401, - "Header": { - "EN": "Show app suggestions in the Start menu", - "RU": "Показывать рекомендации в меню \"Пуск\"", - "DE": "App-Vorschläge im Startmenü anzeigen", - "UA": "Відображати рекомендації в меню \"Пуск\"", - "IT": "Mostra suggerimenti app nel menu Start" - }, - "Description": { - "EN": "", - "RU": "", - "DE": "", - "UA": "", - "IT": "" - }, - "Type": "CheckBox", - "Tag": "StartMenu", - "ViewId": 401, - "Windows10Supported": true, - "Windows11Supported": false - }, - { - "Id": 402, - "Header": { - "EN": "Run the Windows PowerShell shortcut from the Start menu as Administrator", - "RU": "Запускать ярлык Windows PowerShell в меню \"Пуск\" от имени Администратора", - "DE": "Windows PowerShell als Administrator im Startmenü ausführen", - "UA": "Запускати ярлик Windows PowerShell у меню \"Пуск\" від імені Адміністратора", - "IT": "Eseguire il collegamento di Windows PowerShell dal menu Start come amministratore" - }, - "Description": { - "EN": "", - "RU": "", - "DE": "", - "UA": "", - "IT": "" - }, - "Type": "CheckBox", - "Tag": "StartMenu", - "ViewId": 402, - "Windows10Supported": true, - "Windows11Supported": true - }, { "Id": 500, "Header": { @@ -4318,4 +4318,4 @@ "Windows10Supported": true, "Windows11Supported": false } -] +] \ No newline at end of file diff --git a/SophiApp/SophiApp/StartupConditions/OsBuildVersionCondition.cs b/SophiApp/SophiApp/StartupConditions/OsBuildVersionCondition.cs index d33f83a6..e78df3b0 100644 --- a/SophiApp/SophiApp/StartupConditions/OsBuildVersionCondition.cs +++ b/SophiApp/SophiApp/StartupConditions/OsBuildVersionCondition.cs @@ -14,7 +14,7 @@ public bool Invoke() var ubr = OsHelper.GetUpdateBuildRevision(); var build = OsHelper.GetBuild(); var hasProblem = OsHelper.IsWindows11() - ? ubr >= OsHelper.WIN11_MIN_SUPPORTED_UBR || build >= OsHelper.WIN11_MIN_SUPPORTED_INSIDER_BUILD + ? build >= OsHelper.WIN11_MIN_SUPPORTED_BUILD : ubr >= OsHelper.WIN10_MIN_SUPPORTED_UBR; return HasProblem = hasProblem.Invert();