From a7eeaf16f53b6b952848de03c2a0ba8d1eba38e4 Mon Sep 17 00:00:00 2001 From: Belim Date: Mon, 20 Feb 2023 22:08:50 +0100 Subject: [PATCH] Add views........ --- src/BloatyNosy/Features/Apps/StoreApps.cs | 86 +++ .../Features/Apps/StoreAppsEngine.cs | 76 +++ .../Features/Browser/GoogleChrome.cs | 65 +++ .../Features/Browser/MozillaFirefox.cs | 63 +++ src/BloatyNosy/Features/Desktop/AppsTheme.cs | 63 +++ .../Features/Desktop/SnapAssistFlyout.cs | 61 +++ src/BloatyNosy/Features/Desktop/Stickers.cs | 60 +++ .../Features/Desktop/Transparency.cs | 61 +++ src/BloatyNosy/Features/Desktop/Widgets.cs | 61 +++ src/BloatyNosy/Features/Desktop/WidgetsR.cs | 71 +++ .../Features/Desktop/WindowsTheme.cs | 60 +++ .../Features/Explorer/FileExplorer.cs | 61 +++ .../Features/Explorer/HiddenFileExt.cs | 61 +++ .../Features/Explorer/HiddenFileFolder.cs | 61 +++ src/BloatyNosy/Features/Gaming/GameDVR.cs | 74 +++ .../Features/Gaming/PowerThrottling.cs | 65 +++ src/BloatyNosy/Features/Gaming/VisualFX.cs | 64 +++ .../Features/Privacy/Advertising.cs | 61 +++ .../Features/Privacy/AppsAutoInstall.cs | 62 +++ src/BloatyNosy/Features/Privacy/Biometrics.cs | 61 +++ .../Privacy/CompatibilityTelemetry.cs | 62 +++ .../Features/Privacy/DiagnosticData.cs | 61 +++ src/BloatyNosy/Features/Privacy/Feedback.cs | 67 +++ .../Features/Privacy/LocationTracking.cs | 61 +++ .../Features/Privacy/SuggestedContent.cs | 71 +++ .../Features/Privacy/TailoredExperiences.cs | 61 +++ src/BloatyNosy/Features/Privacy/Telemetry.cs | 83 +++ .../Features/Privacy/WindowsTips.cs | 61 +++ .../Features/Recommendation/EnableWSL.cs | 68 +++ src/BloatyNosy/Features/System/FaxPrinter.cs | 51 ++ .../Features/System/FullContextMenus.cs | 60 +++ src/BloatyNosy/Features/System/OneDriveR.cs | 81 +++ .../Features/System/RemoveW11Watermark.cs | 63 +++ src/BloatyNosy/Features/System/TPMCheck.cs | 79 +++ .../Features/System/TeamsAutostart.cs | 72 +++ src/BloatyNosy/Features/System/XPSWriter.cs | 78 +++ .../Features/Taskbar/MostUsedApps.cs | 63 +++ .../Features/Taskbar/StartmenuLayout.cs | 61 +++ src/BloatyNosy/Features/Taskbar/TaskView.cs | 61 +++ .../Features/Taskbar/TaskbarChat.cs | 61 +++ .../Features/Taskbar/TaskbarSearch.cs | 61 +++ .../Views/AboutPageView.Designer.cs | 289 ++++++++++ src/BloatyNosy/Views/AboutPageView.cs | 121 +++++ src/BloatyNosy/Views/AboutPageView.resx | 120 +++++ src/BloatyNosy/Views/AppsPageView.Designer.cs | 413 +++++++++++++++ src/BloatyNosy/Views/AppsPageView.cs | 426 +++++++++++++++ src/BloatyNosy/Views/AppsPageView.resx | 126 +++++ .../Views/IModsPageView.Designer.cs | 188 +++++++ src/BloatyNosy/Views/IModsPageView.cs | 205 +++++++ src/BloatyNosy/Views/IModsPageView.resx | 120 +++++ src/BloatyNosy/Views/ModsPageView.Designer.cs | 406 ++++++++++++++ src/BloatyNosy/Views/ModsPageView.cs | 253 +++++++++ src/BloatyNosy/Views/ModsPageView.resx | 130 +++++ .../Views/PackagesPageView.Designer.cs | 272 ++++++++++ src/BloatyNosy/Views/PackagesPageView.cs | 194 +++++++ src/BloatyNosy/Views/PackagesPageView.resx | 120 +++++ .../Views/SetupPageView.Designer.cs | 236 +++++++++ src/BloatyNosy/Views/SetupPageView.cs | 499 ++++++++++++++++++ src/BloatyNosy/Views/SetupPageView.resx | 120 +++++ 59 files changed, 6921 insertions(+) create mode 100644 src/BloatyNosy/Features/Apps/StoreApps.cs create mode 100644 src/BloatyNosy/Features/Apps/StoreAppsEngine.cs create mode 100644 src/BloatyNosy/Features/Browser/GoogleChrome.cs create mode 100644 src/BloatyNosy/Features/Browser/MozillaFirefox.cs create mode 100644 src/BloatyNosy/Features/Desktop/AppsTheme.cs create mode 100644 src/BloatyNosy/Features/Desktop/SnapAssistFlyout.cs create mode 100644 src/BloatyNosy/Features/Desktop/Stickers.cs create mode 100644 src/BloatyNosy/Features/Desktop/Transparency.cs create mode 100644 src/BloatyNosy/Features/Desktop/Widgets.cs create mode 100644 src/BloatyNosy/Features/Desktop/WidgetsR.cs create mode 100644 src/BloatyNosy/Features/Desktop/WindowsTheme.cs create mode 100644 src/BloatyNosy/Features/Explorer/FileExplorer.cs create mode 100644 src/BloatyNosy/Features/Explorer/HiddenFileExt.cs create mode 100644 src/BloatyNosy/Features/Explorer/HiddenFileFolder.cs create mode 100644 src/BloatyNosy/Features/Gaming/GameDVR.cs create mode 100644 src/BloatyNosy/Features/Gaming/PowerThrottling.cs create mode 100644 src/BloatyNosy/Features/Gaming/VisualFX.cs create mode 100644 src/BloatyNosy/Features/Privacy/Advertising.cs create mode 100644 src/BloatyNosy/Features/Privacy/AppsAutoInstall.cs create mode 100644 src/BloatyNosy/Features/Privacy/Biometrics.cs create mode 100644 src/BloatyNosy/Features/Privacy/CompatibilityTelemetry.cs create mode 100644 src/BloatyNosy/Features/Privacy/DiagnosticData.cs create mode 100644 src/BloatyNosy/Features/Privacy/Feedback.cs create mode 100644 src/BloatyNosy/Features/Privacy/LocationTracking.cs create mode 100644 src/BloatyNosy/Features/Privacy/SuggestedContent.cs create mode 100644 src/BloatyNosy/Features/Privacy/TailoredExperiences.cs create mode 100644 src/BloatyNosy/Features/Privacy/Telemetry.cs create mode 100644 src/BloatyNosy/Features/Privacy/WindowsTips.cs create mode 100644 src/BloatyNosy/Features/Recommendation/EnableWSL.cs create mode 100644 src/BloatyNosy/Features/System/FaxPrinter.cs create mode 100644 src/BloatyNosy/Features/System/FullContextMenus.cs create mode 100644 src/BloatyNosy/Features/System/OneDriveR.cs create mode 100644 src/BloatyNosy/Features/System/RemoveW11Watermark.cs create mode 100644 src/BloatyNosy/Features/System/TPMCheck.cs create mode 100644 src/BloatyNosy/Features/System/TeamsAutostart.cs create mode 100644 src/BloatyNosy/Features/System/XPSWriter.cs create mode 100644 src/BloatyNosy/Features/Taskbar/MostUsedApps.cs create mode 100644 src/BloatyNosy/Features/Taskbar/StartmenuLayout.cs create mode 100644 src/BloatyNosy/Features/Taskbar/TaskView.cs create mode 100644 src/BloatyNosy/Features/Taskbar/TaskbarChat.cs create mode 100644 src/BloatyNosy/Features/Taskbar/TaskbarSearch.cs create mode 100644 src/BloatyNosy/Views/AboutPageView.Designer.cs create mode 100644 src/BloatyNosy/Views/AboutPageView.cs create mode 100644 src/BloatyNosy/Views/AboutPageView.resx create mode 100644 src/BloatyNosy/Views/AppsPageView.Designer.cs create mode 100644 src/BloatyNosy/Views/AppsPageView.cs create mode 100644 src/BloatyNosy/Views/AppsPageView.resx create mode 100644 src/BloatyNosy/Views/IModsPageView.Designer.cs create mode 100644 src/BloatyNosy/Views/IModsPageView.cs create mode 100644 src/BloatyNosy/Views/IModsPageView.resx create mode 100644 src/BloatyNosy/Views/ModsPageView.Designer.cs create mode 100644 src/BloatyNosy/Views/ModsPageView.cs create mode 100644 src/BloatyNosy/Views/ModsPageView.resx create mode 100644 src/BloatyNosy/Views/PackagesPageView.Designer.cs create mode 100644 src/BloatyNosy/Views/PackagesPageView.cs create mode 100644 src/BloatyNosy/Views/PackagesPageView.resx create mode 100644 src/BloatyNosy/Views/SetupPageView.Designer.cs create mode 100644 src/BloatyNosy/Views/SetupPageView.cs create mode 100644 src/BloatyNosy/Views/SetupPageView.resx diff --git a/src/BloatyNosy/Features/Apps/StoreApps.cs b/src/BloatyNosy/Features/Apps/StoreApps.cs new file mode 100644 index 0000000..884cd30 --- /dev/null +++ b/src/BloatyNosy/Features/Apps/StoreApps.cs @@ -0,0 +1,86 @@ +using BloatyNosy; +using System.Linq; +using System.Management.Automation; +using System.Text.RegularExpressions; + +namespace Features.Feature.Apps +{ + internal class StoreApps : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + private readonly PowerShell powerShell = PowerShell.Create(); + + public override string ID() + { + return "[HIGH] Search and remove pre-installed bloatware apps automatically"; + } + + public override string Info() + { + return "To remove specific apps use the BloatFinder app in the \"More Apps\" section"; + } + + private void RemoveApps(string str) + { + bool error = false; + using (PowerShell script = PowerShell.Create()) + { + script.AddScript("Get-AppxPackage " + str + " | Remove-AppxPackage"); + + script.Invoke(); + error = script.HadErrors; + } + + if (error) + { + logger.Log("Error removing " + str); + } + else + { + logger.Log("App removed " + str); + } + + return; + } + + public override bool CheckFeature() + { + var apps = BloatwareList.GetList(); + + powerShell.Commands.Clear(); + powerShell.AddCommand("get-appxpackage"); + powerShell.AddCommand("Select").AddParameter("property", "name"); + + logger.Log("We found the following bloatware on your system: (if no apps are listed, then nothing was found)"); + + foreach (PSObject result in powerShell.Invoke()) + { + string current = result.ToString(); + + if (!apps.Contains(Regex.Replace(current, "(@{Name=)|(})", ""))) continue; + logger.Log("- " + (Regex.Replace(current, "(@{Name=)|(})", ""))); + } + return true; + } + + public override bool DoFeature() + { + var apps = BloatwareList.GetList(); + + logger.Log("Searching bloatware database..."); + foreach (var str in apps) + { + logger.Log("- Uninstalling " + str.ToString()); + RemoveApps(str); + } + + return true; + } + + public override bool UndoFeature() + { + logger.Log("-[RemoveStoreApps] This feature does not provide a restore mode."); + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Apps/StoreAppsEngine.cs b/src/BloatyNosy/Features/Apps/StoreAppsEngine.cs new file mode 100644 index 0000000..f5b3525 --- /dev/null +++ b/src/BloatyNosy/Features/Apps/StoreAppsEngine.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; + +namespace BloatyNosy +{ + public static class BloatwareList + { + // Our Windows 11 bloatware list + public static IEnumerable GetList() + { + var apps = new List + { + "2FE3CB00.PICSART-PHOTOSTUDIO", + "4DF9E0F8.Netflix", + "5319275A.WhatsAppDesktop", + "9E2F88E3.TWITTER", + "NAVER.LINEwin8_8ptj331gd3tyt", + "SpotifyAB.SpotifyMusic", + "king.com.CandyCrushFriends", + "king.com.CandyCrushSaga", + "king.com.FarmHeroesSaga", + "22364Disney.ESPNBetaPWA", + "5A894077.McAfeeSecurity", + "AdobeSystemsIncorporated.AdobeCreativeCloudExpress", + "AmazonVideo.PrimeVideo", + "AppUp.IntelGraphicsExperience", + "B9ECED6F.ASUSPCAssistant", + "B9ECED6F.ScreenPadMaster", + "BytedancePte.Ltd.TikTok", + "Clipchamp.Clipchamp", + "DTSInc.DTSAudioProcess", + "FACEBOOK.317180B0BB486", + "Facebook.InstagramBeta", + "AdobeSystemsIncorporated.AdobeLightroom", + "AdobeSystemsIncorporated.AdobePhotoshopExpress", + "Clipchamp.Clipchamp_yxz26nhyzhsrt", + "CorelCorporation.PaintShopPro", + "FACEBOOK.317180B0BB486", + "Facebook.InstagramBeta", + "AD2F1837.HPJumpStarts", + "AD2F1837.HPPCHardwareDiagnosticsWindows", + "AD2F1837.HPPowerManager", + "AD2F1837.HPPrivacySettings", + "AD2F1837.HPSupportAssistant", + "AD2F1837.HPSureShieldAI", + "AD2F1837.HPSystemInformation", + "AD2F1837.HPQuickDrop", + "AD2F1837.HPWorkWell", + "AD2F1837.myHP", + "AD2F1837.HPDesktopSupportUtilities", + "AD2F1837.HPQuickTouch", + "AD2F1837.HPEasyClean", + "AD2F1837.HPSystemInformation", + "Microsoft.549981C3F5F10", + "Microsoft.BingNews", + "Microsoft.BingWeather", + "Microsoft.GamingApp", + "Microsoft.Getstarted", + "Microsoft.Microsoft3DViewer", + "Microsoft.MicrosoftOfficeHub", + "Microsoft.MicrosoftSolitaireCollection", + "Microsoft.MicrosoftStickyNotes", + "Microsoft.MixedReality.Portal", + "Microsoft.Office.OneNote", + "Microsoft.OneDriveSync", + "Microsoft.OneConnect", + "Microsoft.People", + "Microsoft.Print3D", + "Microsoft.SkypeApp", + "Microsoft.Wallet", + "Microsoft.WindowsSoundRecorder" + }; + + return apps; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Browser/GoogleChrome.cs b/src/BloatyNosy/Features/Browser/GoogleChrome.cs new file mode 100644 index 0000000..72eb67d --- /dev/null +++ b/src/BloatyNosy/Features/Browser/GoogleChrome.cs @@ -0,0 +1,65 @@ +using BloatyNosy; +using Microsoft.Win32; + +namespace Features.Feature.Browser +{ + internal class ChromeTelemetry : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome"; + private const int desiredValue = 0; + + public override string ID() + { + return "[HIGH] Disable Google Chrome Telemetry"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "MetricsReportingEnabled", desiredValue) && + RegistryHelper.IntEquals(keyName, "ChromeCleanupReportingEnabled", desiredValue) && + RegistryHelper.IntEquals(keyName, "SubscribedContent-353696Enabled", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "MetricsReportingEnabled", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName, "ChromeCleanupReportingEnabled", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName, "SubscribedContent-353696Enabled", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Google Chrome Telemetry has been disabled."); + logger.Log(keyName); + + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.LocalMachine.DeleteSubKeyTree(@"Software\Policies\Google\Chrome", false); + logger.Log("- Google Chrome Telemetry has been enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Browser/MozillaFirefox.cs b/src/BloatyNosy/Features/Browser/MozillaFirefox.cs new file mode 100644 index 0000000..17511ac --- /dev/null +++ b/src/BloatyNosy/Features/Browser/MozillaFirefox.cs @@ -0,0 +1,63 @@ +using BloatyNosy; +using Microsoft.Win32; + +namespace Features.Feature.Browser +{ + internal class FirefoxTelemetry : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Mozilla\Firefox"; + private const int desiredValue = 1; + + public override string ID() + { + return "[HIGH] Disable Mozilla Firefox Telemetry"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "DisableTelemetry", desiredValue) && + RegistryHelper.IntEquals(keyName, "DisableDefaultBrowserAgent", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "DisableTelemetry", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName, "DisableDefaultBrowserAgent", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Mozilla Firefox Telemetry has been disabled."); + logger.Log(keyName); + + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.LocalMachine.DeleteSubKeyTree(@"Policies\Mozilla\Firefox", false); + logger.Log(" Mozilla Firefox Telemetry has been enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Desktop/AppsTheme.cs b/src/BloatyNosy/Features/Desktop/AppsTheme.cs new file mode 100644 index 0000000..055030f --- /dev/null +++ b/src/BloatyNosy/Features/Desktop/AppsTheme.cs @@ -0,0 +1,63 @@ +using BloatyNosy; +using Microsoft.Win32; + +namespace Features.Feature.Desktop +{ + internal class AppsTheme : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"; + private const int desiredValue = 0; + + public override string ID() + { + return "[LOW] Use Apps dark theme"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "AppsUseLightTheme", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "AppsUseLightTheme", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Apps dark theme has been successfully enabled."); + logger.Log(keyName); + + logger.Log("\n\nDark theme will also be enabled for BloatyNosy.\nPlease restart the app for the changes to take effect."); + + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "AppsUseLightTheme", "1", RegistryValueKind.DWord); + logger.Log("- Apps light theme has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Desktop/SnapAssistFlyout.cs b/src/BloatyNosy/Features/Desktop/SnapAssistFlyout.cs new file mode 100644 index 0000000..338c7d0 --- /dev/null +++ b/src/BloatyNosy/Features/Desktop/SnapAssistFlyout.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Desktop +{ + internal class SnapAssistFlyout : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; + private const int desiredValue = 0; + + public override string ID() + { + return "[LOW] Disable Snap Assist"; + } + + public override string Info() + { + return "When you hover over the maximize button in apps, this feature gives you a flyout to display possible layouts."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "EnableSnapAssistFlyout", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "EnableSnapAssistFlyout", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Snap Assist Layout has been disabled.\nPlease restart your PC for the changes to take effect."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable Snap Assist {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "EnableSnapAssistFlyout", 1, RegistryValueKind.DWord); + logger.Log("- Snap Assist has been enabled.\nPlease restart your PC for the changes to take effect."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Desktop/Stickers.cs b/src/BloatyNosy/Features/Desktop/Stickers.cs new file mode 100644 index 0000000..852646c --- /dev/null +++ b/src/BloatyNosy/Features/Desktop/Stickers.cs @@ -0,0 +1,60 @@ +using BloatyNosy; +using Microsoft.Win32; + +namespace Features.Feature.Desktop +{ + internal class Stickers : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Stickers"; + private const int desiredValue = 0; + + public override string ID() + { + return "[HIGH] Remove Desktop Stickers"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "EnableStickers", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "EnableStickers", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Desktop Stickers has been removed."); + logger.Log(keyName); + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "EnableStickers", "1", RegistryValueKind.DWord); + logger.Log("- Desktop Sticker feature has been enabled again."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Desktop/Transparency.cs b/src/BloatyNosy/Features/Desktop/Transparency.cs new file mode 100644 index 0000000..85f35b4 --- /dev/null +++ b/src/BloatyNosy/Features/Desktop/Transparency.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Desktop +{ + internal class Transparency : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"; + private const int desiredValue = 0; + + public override string ID() + { + return "[LOW] Disable acrylic Fluent Design effects"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "EnableTransparency", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "EnableTransparency", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Transparency effects has been disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable transparency effects {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "EnableTransparency", 1, RegistryValueKind.DWord); + logger.Log("- Transparency effects has been enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Desktop/Widgets.cs b/src/BloatyNosy/Features/Desktop/Widgets.cs new file mode 100644 index 0000000..5695594 --- /dev/null +++ b/src/BloatyNosy/Features/Desktop/Widgets.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Desktop +{ + internal class Widgets : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; + private const int desiredValue = 0; + + public override string ID() + { + return "[MIDDLE] Disable Widgets"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "TaskbarDa", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "TaskbarDa", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Widgets has been disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable Widgets {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "TaskbarDa", 1, RegistryValueKind.DWord); + logger.Log("- Widgets has been enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Desktop/WidgetsR.cs b/src/BloatyNosy/Features/Desktop/WidgetsR.cs new file mode 100644 index 0000000..6633932 --- /dev/null +++ b/src/BloatyNosy/Features/Desktop/WidgetsR.cs @@ -0,0 +1,71 @@ +using BloatyNosy; +using System; +using System.Diagnostics; +using System.IO; +using System.Net; + +namespace Features.Feature.Desktop +{ + internal class WidgetsRemove : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + public override string ID() + { + return "[MIDDLE] Uninstall Widgets feature"; + } + + public override string Info() + { + return "The Widgets app runs in the background even with the option turned off.\nThis will uninstall the Widgets app package."; + } + + public override bool CheckFeature() + { + var appPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Packages", "MicrosoftWindows.Client.WebExperience_cw5n1h2txyewy"); + + if (!Directory.Exists(appPath)) + { + return false; + } + + return true; + } + + public override bool DoFeature() + { + try + { + using (var client = new WebClient()) + { + logger.Log("- Uninstalling Widgets app"); + WindowsHelper.RunWT("winget uninstall \"windows web experience pack\""); + logger.Log("Done."); + return true; + } + } + catch (Exception ex) + { logger.Log("{0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + using (var client = new WebClient()) + { + logger.Log("- Installing Widgets app...\nWe've opened the download link in the Microsoft Store.\nPlease install the package \"Windows Web Experience Pack\". "); + Process.Start("ms-windows-store://pdp/?ProductId=9MSSGKG348SP"); + + return true; + } + } + catch (Exception ex) + { logger.Log("{0}", ex.Message); } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Desktop/WindowsTheme.cs b/src/BloatyNosy/Features/Desktop/WindowsTheme.cs new file mode 100644 index 0000000..36f00f6 --- /dev/null +++ b/src/BloatyNosy/Features/Desktop/WindowsTheme.cs @@ -0,0 +1,60 @@ +using BloatyNosy; +using Microsoft.Win32; + +namespace Features.Feature.Desktop +{ + internal class WindowsTheme : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"; + private const int desiredValue = 0; + + public override string ID() + { + return "[LOW] Use Windows dark theme"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "SystemUsesLightTheme", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "SystemUsesLightTheme", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Windows dark theme has been successfully enabled."); + logger.Log(keyName); + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "SystemUsesLightTheme", "1", RegistryValueKind.DWord); + logger.Log("- Windows light theme has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Explorer/FileExplorer.cs b/src/BloatyNosy/Features/Explorer/FileExplorer.cs new file mode 100644 index 0000000..27556cd --- /dev/null +++ b/src/BloatyNosy/Features/Explorer/FileExplorer.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; + +namespace Features.Feature.Explorer +{ + internal class FileExplorer : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked"; + + public override string ID() + { + return "[LOW] Enable Windows 10 File Explorer"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.StringEquals(keyName, "{e2bf9676-5f8f-435c-97eb-11607a5bedf7}", "") + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "{e2bf9676-5f8f-435c-97eb-11607a5bedf7}", "", RegistryValueKind.String); + + logger.Log("- Windows 10 File Explorer has been successfully enabled.\nRestart is required for the changes to take effect!"); + logger.Log(keyName); + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + var RegKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked", true); + RegKey.DeleteValue("{e2bf9676-5f8f-435c-97eb-11607a5bedf7}"); + + logger.Log("- Windows 10 File Explorer has been successfully disabled.\nRestart is required for the changes to take effect!"); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Explorer/HiddenFileExt.cs b/src/BloatyNosy/Features/Explorer/HiddenFileExt.cs new file mode 100644 index 0000000..3907375 --- /dev/null +++ b/src/BloatyNosy/Features/Explorer/HiddenFileExt.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Explorer +{ + internal class HiddenFileExt : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; + private const int desiredValue = 0; + + public override string ID() + { + return "[HIGH] Show hidden file name extensions"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "HideFileExt", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "HideFileExt", desiredValue, RegistryValueKind.DWord); + + logger.Log("- File name extensions are now visible."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not hide file name extensions {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "HideFileExt", 1, RegistryValueKind.DWord); + logger.Log("- File name extensions are now hidden again."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Explorer/HiddenFileFolder.cs b/src/BloatyNosy/Features/Explorer/HiddenFileFolder.cs new file mode 100644 index 0000000..83bcb18 --- /dev/null +++ b/src/BloatyNosy/Features/Explorer/HiddenFileFolder.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Explorer +{ + internal class HiddenFileFolder : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; + private const int desiredValue = 1; + + public override string ID() + { + return "[HIGH] Show hidden files, folders and drives in File Explorer"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "Hidden", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "Hidden", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Hidden files, folders and drives are now visible."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not hide files, folders and drives {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "Hidden", 2, RegistryValueKind.DWord); + logger.Log("- Files, folders and drives are now hidden again."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Gaming/GameDVR.cs b/src/BloatyNosy/Features/Gaming/GameDVR.cs new file mode 100644 index 0000000..097291c --- /dev/null +++ b/src/BloatyNosy/Features/Gaming/GameDVR.cs @@ -0,0 +1,74 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Gaming +{ + internal class GameDVR : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\System\GameConfigStore"; + private const string keyName2 = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR"; + private const int desiredValue = 0; + private const int desiredValue2 = 2; + private const int desiredValue3 = 0; + + public override string ID() + { + return "[MIDDLE] Disable Game DVR feature"; + } + + public override string Info() + { + return "The built-in Game DVR feature helps you record your gameplay, capture screenshots, and share them online.\n" + + "But it can interfere with your game’s performance, too. Background recording requires some of your GPU power, and some gamers will want all the GPU power they can get.\n" + + "If you experience low FPS or FPS loss after upgrading to Windows 11, you may resolve the issue by disabling the Xbox DVR feature."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "GameDVR_Enabled", desiredValue) && + RegistryHelper.IntEquals(keyName, "GameDVR_FSEBehaviorMode", desiredValue2) && + RegistryHelper.IntEquals(keyName2, "value", desiredValue3) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "GameDVR_Enabled", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName, "GameDVR_FSEBehaviorMode", desiredValue2, RegistryValueKind.DWord); + Registry.SetValue(keyName2, "value", desiredValue3, RegistryValueKind.DWord); + + logger.Log("- Game DVR feature has been successfully disabled."); + logger.Log(keyName + Environment.NewLine + keyName2); + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "GameDVR_Enabled", "1", RegistryValueKind.DWord); + Registry.SetValue(keyName, "GameDVR_FSEBehaviorMode", "0", RegistryValueKind.DWord); + Registry.SetValue(keyName2, "value", 1, RegistryValueKind.DWord); + + logger.Log("- Game DVR feature has been successfully enabled."); + logger.Log(keyName + Environment.NewLine + keyName2); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Gaming/PowerThrottling.cs b/src/BloatyNosy/Features/Gaming/PowerThrottling.cs new file mode 100644 index 0000000..74f33c9 --- /dev/null +++ b/src/BloatyNosy/Features/Gaming/PowerThrottling.cs @@ -0,0 +1,65 @@ +using BloatyNosy; +using Microsoft.Win32; + +namespace Features.Feature.Gaming +{ + internal class PowerThrottling : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling"; + private const int desiredValue = 1; + + public override string ID() + { + return "[MIDDLE] Disable PowerThrottling"; + } + + public override string Info() + { + return "With the Windows 10 Fall Creators Update, Microsoft’s OS has added feature called Power Throttling\n" + + "(Power Throttling is only available on Intel 6th gen and higher processors), a way to increase the battery life of laptops by slowing down background processes.\n" + + "This feature is enabled by default in laptops and tablets. Though Windows is good at detecting background apps and limiting power, there might be situations where this feature is not so desirable."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "PowerThrottlingOff", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "PowerThrottlingOff", desiredValue, RegistryValueKind.DWord); + + logger.Log("- PowerThrottling has been successfully disabled."); + logger.Log(keyName); + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + var RegKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Power\PowerThrottling", true); + RegKey.DeleteValue("PowerThrottlingOff"); + + logger.Log("- PowerThrottling has been successfully enabled."); + logger.Log(keyName); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Gaming/VisualFX.cs b/src/BloatyNosy/Features/Gaming/VisualFX.cs new file mode 100644 index 0000000..e2eed81 --- /dev/null +++ b/src/BloatyNosy/Features/Gaming/VisualFX.cs @@ -0,0 +1,64 @@ +using BloatyNosy; +using Microsoft.Win32; + +namespace Features.Feature.Gaming +{ + internal class VisualFX : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects"; + private const int desiredValue = 2; + + public override string ID() + { + return "[MIDDLE] Adjust visual effects for best performance"; + } + + public override string Info() + { + return "Visual effects are the visual bells and whistles for the appearance of Windows for your account.\n" + + "These visual bells and whistles can affect the performance of Windows on the PC though.\n" + + "This will turn off all visual effects under My computer->Properties->Advanced->Settings->and set to \"Adjust for best performance\""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "VisualFXSetting", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "VisualFXSetting", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Visual effects has been optimized."); + logger.Log(keyName); + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "VisualFXSetting", 0, RegistryValueKind.DWord); + + logger.Log("- Visual effects has been set to default choosing Windows what's best for your computer."); + logger.Log(keyName); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/Advertising.cs b/src/BloatyNosy/Features/Privacy/Advertising.cs new file mode 100644 index 0000000..d106b93 --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/Advertising.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class Advertising : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo"; + private const int desiredValue = 0; + + public override string ID() + { + return "[HIGH] Disable Advertising ID for Relevant Ads"; + } + + public override string Info() + { + return "Windows 11 comes integrated with advertising. Microsoft assigns a unique identificator to track your activity in the Microsoft Store and on UWP apps to target you with relevant ads."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "Enabled", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "Enabled", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Advertising ID for Relevant Ads has been successfully disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable advertising ID for Relevant Ads {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "Enabled", 1, RegistryValueKind.DWord); + logger.Log("- Advertising ID for Relevant Ads has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/AppsAutoInstall.cs b/src/BloatyNosy/Features/Privacy/AppsAutoInstall.cs new file mode 100644 index 0000000..cc87f01 --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/AppsAutoInstall.cs @@ -0,0 +1,62 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class AppsAutoInstall : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const int desiredValue = 0; + + public override string ID() + { + return "[HIGH] Disable Automatic Installation of apps"; + } + + public override string Info() + { + return "When you sign-in to a new Windows 11 profile or device for the first time, chance is that you notice several third - party applications and games listed prominently in the Start menu.\n" + + "This setting will block automatic Installation of suggested Windows 11 apps."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "SilentInstalledAppsEnabled", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "SilentInstalledAppsEnabled", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Automatic Installation of apps has been successfully disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable automatic Installation of apps {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "SilentInstalledAppsEnabled", 1, RegistryValueKind.DWord); + logger.Log("- Automatic Installation of apps has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/Biometrics.cs b/src/BloatyNosy/Features/Privacy/Biometrics.cs new file mode 100644 index 0000000..a26cb98 --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/Biometrics.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class Biometrics : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Biometrics"; + private const int desiredValue = 0; + + public override string ID() + { + return "[LOW] Disable Windows Hello Biometrics"; + } + + public override string Info() + { + return "Windows Hello biometrics lets you sign in to your devices, apps, online services, and networks using your face, iris, or fingerprint."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "Enabled", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "Enabled", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Windows Hello Biometrics has been successfully disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable Windows Hello Biometrics {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "Enabled", 1, RegistryValueKind.DWord); + logger.Log("- Windows Hello Biometrics has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/CompatibilityTelemetry.cs b/src/BloatyNosy/Features/Privacy/CompatibilityTelemetry.cs new file mode 100644 index 0000000..f965c2d --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/CompatibilityTelemetry.cs @@ -0,0 +1,62 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class CompatibilityTelemetry : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\CompatTelRunner.exe"; + private const string desiredValue = @"%windir%\System32\taskkill.exe"; + + public override string ID() + { + return "[HIGH] Disable Compatibility Telemetry"; + } + + public override string Info() + { + return "This process is periodically collecting a variety of technical data about your computer and its performance and sending it to Microsoft for its Windows Customer Experience Improvement Program."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.StringEquals(keyName, "Debugger", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "Debugger", desiredValue, RegistryValueKind.String); + logger.Log("- Compatibility Telemetry has been successfully disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable compatibility telemetry: {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + var RegKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\CompatTelRunner.exe", true); + RegKey.DeleteValue("Debugger"); + + logger.Log("- Compatibility Telemetry has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/DiagnosticData.cs b/src/BloatyNosy/Features/Privacy/DiagnosticData.cs new file mode 100644 index 0000000..6cfbcf6 --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/DiagnosticData.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class DiagnosticData : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy"; + private const int desiredValue = 0; + + public override string ID() + { + return "[HIGH] Disable Diagnostic data"; + } + + public override string Info() + { + return "This will turn off tailored experiences with relevant tips and recommendations by using your diagnostics data. Many people would call this telemetry, or even spying."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "TailoredExperiencesWithDiagnosticDataEnabled", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "TailoredExperiencesWithDiagnosticDataEnabled", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Diagnostic data has been successfully disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable Diagnostic data {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "TailoredExperiencesWithDiagnosticDataEnabled", 1, RegistryValueKind.DWord); + logger.Log("- Diagnostic data has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/Feedback.cs b/src/BloatyNosy/Features/Privacy/Feedback.cs new file mode 100644 index 0000000..4d2e31b --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/Feedback.cs @@ -0,0 +1,67 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class Feedback : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string periodInNanoSeconds = @"HKEY_CURRENT_USER\Software\Microsoft\Siuf\Rules"; + private const string numberOfSIUFInPeriod = @"HKEY_CURRENT_USER\Software\Microsoft\Siuf\Rules"; + private const int desiredValue = 0; + + public override string ID() + { + return "[HIGH] Disable Feedback notifications"; + } + + public override string Info() + { + return "Changes the Windows 11 feedback frequency from Automatically to Never."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(periodInNanoSeconds, "PeriodInNanoSeconds", desiredValue) && + RegistryHelper.IntEquals(numberOfSIUFInPeriod, "NumberOfSIUFInPeriod", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(periodInNanoSeconds, "PeriodInNanoSeconds", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(numberOfSIUFInPeriod, "NumberOfSIUFInPeriod", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Feedback has been successfully disabled."); + logger.Log(periodInNanoSeconds + Environment.NewLine + numberOfSIUFInPeriod); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable Feedback {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + var RegKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Siuf\Rules", true); + RegKey.DeleteValue("NumberOfSIUFInPeriod"); + RegKey.DeleteValue("PeriodInNanoSeconds"); + + logger.Log("- Feedback has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/LocationTracking.cs b/src/BloatyNosy/Features/Privacy/LocationTracking.cs new file mode 100644 index 0000000..f0fc875 --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/LocationTracking.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class LocationTracking : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location"; + private const string desiredValue = @"Deny"; + + public override string ID() + { + return "[HIGH] Disable Location tracking"; + } + + public override string Info() + { + return "Wherever you go, Windows 11 knows you're there. When Location Tracking is turned on, Windows and its apps are allowed to detect the current location of your computer or device."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.StringEquals(keyName, "Value", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "Value", desiredValue, RegistryValueKind.String); + + logger.Log("- Location tracking has been successfully disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable location tracking {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "Value", "Allow", RegistryValueKind.String); + logger.Log("- Location tracking info has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/SuggestedContent.cs b/src/BloatyNosy/Features/Privacy/SuggestedContent.cs new file mode 100644 index 0000000..c7fcbed --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/SuggestedContent.cs @@ -0,0 +1,71 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class SuggestedContent : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const string keyName2 = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const string keyName3 = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const int desiredValue = 0; + + public override string ID() + { + return "[HIGH] Disable Suggested content in Settings app"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "SubscribedContent-338393Enabled", desiredValue) && + RegistryHelper.IntEquals(keyName2, "SubscribedContent-353694Enabled", desiredValue) && + RegistryHelper.IntEquals(keyName3, "SubscribedContent-353696Enabled", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "SubscribedContent-338393Enabled", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName2, "SubscribedContent-353694Enabled", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName3, "SubscribedContent-353696Enabled", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Suggested content in Settings app has been successfully disabled."); + logger.Log(keyName + Environment.NewLine + keyName2 + Environment.NewLine + keyName3); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable suggested content in Settings app {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "SubscribedContent-338393Enabled", 1, RegistryValueKind.DWord); + Registry.SetValue(keyName2, "SubscribedContent-353694Enabled", 1, RegistryValueKind.DWord); + Registry.SetValue(keyName3, "SubscribedContent-353696Enabled", 1, RegistryValueKind.DWord); + + logger.Log("- Suggested content in Settings app has been successfully enabled."); + logger.Log(keyName + Environment.NewLine + keyName2 + Environment.NewLine + keyName3); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/TailoredExperiences.cs b/src/BloatyNosy/Features/Privacy/TailoredExperiences.cs new file mode 100644 index 0000000..0191baf --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/TailoredExperiences.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class TailoredExperiences : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy"; + private const int desiredValue = 0; + + public override string ID() + { + return "[HIGH] Disable Tailored experiences"; + } + + public override string Info() + { + return "This will prevent Windows 11 using your diagnostic data for personalized tips, ads, and recommendations."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "TailoredExperiencesWithDiagnosticDataEnabled", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "TailoredExperiencesWithDiagnosticDataEnabled", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Tailored experiences has been successfully disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable Tailored experiences {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "TailoredExperiencesWithDiagnosticDataEnabled", 1, RegistryValueKind.DWord); + logger.Log("- Tailored experiences has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/Telemetry.cs b/src/BloatyNosy/Features/Privacy/Telemetry.cs new file mode 100644 index 0000000..a0f28b5 --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/Telemetry.cs @@ -0,0 +1,83 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class Telemetry : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string dataCollection = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DataCollection"; + private const string diagTrack = @"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\DiagTrack"; + private const string dmwappushservice = @"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\dmwappushservice"; + private const int desiredValue = 0; + + public override string ID() + { + return "[MIDDLE] Disable Connected User Experiences and Telemetry"; + } + + public override string Info() + { + return "This will prevent Windows from collecting usage information and setting diagnostic data to Basic, which is the lowest level available for all consumer versions of Windows 11.\n" + + "The services diagtrack & dmwappushservice will also be disabled.\nNOTE: Diagnostic Data must be set to Full to get preview builds from Windows-Insider-Program!"; + } + + public override bool CheckFeature() + { + // WindowsHelper.IsServiceRunning("DiagTrack"); + // WindowsHelper.IsServiceRunning("dmwappushservice"); + + return !( + RegistryHelper.IntEquals(dataCollection, "AllowTelemetry", desiredValue) && + RegistryHelper.IntEquals(diagTrack, "Start", 4) && + RegistryHelper.IntEquals(dmwappushservice, "Start", 4) + + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(dataCollection, "AllowTelemetry", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(diagTrack, "Start", 4, RegistryValueKind.DWord); + Registry.SetValue(dmwappushservice, "Start", 4, RegistryValueKind.DWord); + + WindowsHelper.DisableService("DiagTrack"); + WindowsHelper.DisableService("dmwappushservice"); + + logger.Log("- Connected User Experiences and Telemetry has been successfully disabled."); + logger.Log(dataCollection + Environment.NewLine + diagTrack + Environment.NewLine + dmwappushservice); + + return true; + } + catch (Exception ex) + { logger.Log("Could not disable telemetry: {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(dataCollection, "AllowTelemetry", 3, RegistryValueKind.DWord); + Registry.SetValue(diagTrack, "Start", 2, RegistryValueKind.DWord); + Registry.SetValue(dmwappushservice, "Start", 2, RegistryValueKind.DWord); + + WindowsHelper.EnableService("DiagTrack"); + WindowsHelper.EnableService("dmwappushservice"); + + logger.Log("- Connected User Experiences and Telemetry has been successfully enabled."); + logger.Log(dataCollection + Environment.NewLine + diagTrack + Environment.NewLine + dmwappushservice); + return true; + } + catch (Exception ex) + { logger.Log("Could not enable telemetry: {0}", ex.Message); } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Privacy/WindowsTips.cs b/src/BloatyNosy/Features/Privacy/WindowsTips.cs new file mode 100644 index 0000000..bc41067 --- /dev/null +++ b/src/BloatyNosy/Features/Privacy/WindowsTips.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Privacy +{ + internal class WindowsTips : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager "; + private const int desiredValue = 0; + + public override string ID() + { + return "[LOW] Disable Windows tips"; + } + + public override string Info() + { + return "You will no longer see Windows tips, e.g. Spotlight and Consumer Features, Feedback Notifications etc."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "SubscribedContent-338393Enabled", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "SubscribedContent-338393Enabled", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Windows 11 tips has been successfully disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable Windows 11 tips {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "SubscribedContent-338393Enabled", 1, RegistryValueKind.DWord); + logger.Log("- Windows 11 tips has been successfully enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Recommendation/EnableWSL.cs b/src/BloatyNosy/Features/Recommendation/EnableWSL.cs new file mode 100644 index 0000000..b41507c --- /dev/null +++ b/src/BloatyNosy/Features/Recommendation/EnableWSL.cs @@ -0,0 +1,68 @@ +using BloatyNosy; +using System.Management.Automation; + +namespace Features.Feature.Recommendation +{ + internal class EnableWSL : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + public override string ID() + { + return "[LOW] We've recommend enabling Microsoft Windows Subsystem for Linux"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + string script = "Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux"; + PowerShell powerShell = PowerShell.Create(); + powerShell.AddScript(script); + var results = powerShell.Invoke(); + + foreach (var item in results) + { + var Status = item.Members["State"].Value; + + if (Status.ToString() == "Enabled") + { + logger.Log("Problem on Features: [SOLVED] We found a recommended feature on your system \"Microsoft Windows Subsystem for Linux\""); + return false; + } + } + //logger.Log("Microsoft Windows Subsystem for Linux is disabled."); + + return true; + } + + public override bool DoFeature() + { + string script = "Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux"; + + PowerShell powerShell = PowerShell.Create(); + + powerShell.AddScript(script); + powerShell.Invoke(); + + logger.Log("- Microsoft Windows Subsystem for Linux has been successfully enabled."); + return true; + } + + public override bool UndoFeature() + { + string script = "Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux"; + + PowerShell powerShell = PowerShell.Create(); + + powerShell.AddScript(script); + powerShell.Invoke(); + + logger.Log("- Microsoft Windows Subsystem for Linux has been successfully disabled."); + return true; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/System/FaxPrinter.cs b/src/BloatyNosy/Features/System/FaxPrinter.cs new file mode 100644 index 0000000..35f2062 --- /dev/null +++ b/src/BloatyNosy/Features/System/FaxPrinter.cs @@ -0,0 +1,51 @@ +using BloatyNosy; +using System.Management.Automation; + +namespace Features.Feature.System +{ + internal class Fax : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + public override string ID() + { + return "[LOW] Remove Fax Printer"; + } + + public override string Info() + { + return "This operation cannot be undone!"; + } + + public override bool CheckFeature() + { + logger.Log("Problem on System: [UNKNOWN] Fax Printer check can not be performed, but we can remove it."); + return false; + } + + public override bool DoFeature() + { + string script = "Remove-Printer -Name \"Fax\""; + + PowerShell powerShell = PowerShell.Create(); + + powerShell.AddScript(script); + powerShell.Invoke(); + + if (powerShell.Streams.Error.Count > 0) + { + logger.Log("Fax Printer not found."); + return false; + } + + logger.Log("- Fax printer has been successfully removed."); + return true; + } + + public override bool UndoFeature() + { + logger.Log("- Fax printer can not be installed."); + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/System/FullContextMenus.cs b/src/BloatyNosy/Features/System/FullContextMenus.cs new file mode 100644 index 0000000..c5c717b --- /dev/null +++ b/src/BloatyNosy/Features/System/FullContextMenus.cs @@ -0,0 +1,60 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.System +{ + internal class FullContextMenus : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\SOFTWARE\CLASSES\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32"; + + public override string ID() + { + return "[MIDDLE] Enable Full Context Menus in Windows 11"; + } + + public override string Info() + { + return "Truncated context menus are Windows 11's worst feature."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.StringEquals(keyName, "", "") + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "", "", RegistryValueKind.String); + + logger.Log("- Full Context Menus in Windows 11 have been enabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not enable Full Context Menus in Windows 11 {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.CurrentUser.DeleteSubKeyTree(@"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}", false); + + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/System/OneDriveR.cs b/src/BloatyNosy/Features/System/OneDriveR.cs new file mode 100644 index 0000000..e9a27f3 --- /dev/null +++ b/src/BloatyNosy/Features/System/OneDriveR.cs @@ -0,0 +1,81 @@ +using BloatyNosy; +using System; +using System.Diagnostics; +using System.IO; +using System.Net; + +namespace Features.Feature.System +{ + internal class OneDriveRemove : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + public override string ID() + { + return "[MIDDLE] Uninstall OneDrive"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + var appPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\OneDrive\OneDrive.exe"; + + if (!File.Exists(appPath)) + { + return false; + } + + return true; + } + + public override bool DoFeature() + { + try + { + Process proc = new Process(); + proc.StartInfo.CreateNoWindow = true; + proc.StartInfo.RedirectStandardError = true; + proc.StartInfo.RedirectStandardOutput = true; + proc.StartInfo.UseShellExecute = false; + + logger.Log("Uninstalling OneDrive...Please wait."); + string sysEnv = Environment.GetEnvironmentVariable("SYSTEMROOT"); + proc.StartInfo.FileName = "taskkill"; proc.StartInfo.Arguments = "/F /IM OneDrive.exe"; + proc.Start(); + + proc.StartInfo.FileName = (sysEnv + @"\System32\OneDriveSetup.exe"); + proc.StartInfo.Arguments = "/uninstall"; + proc.Start(); + + proc.WaitForExit(); + logger.Log("Onedrive has been successfully uninstalled."); + } + catch (Exception ex) + { logger.Log("{0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + using (var client = new WebClient()) + { + logger.Log("We've opened the download link in your Browser.\n\nPlease install the package \"OneDrive\". "); + Process.Start("https://www.microsoft.com/microsoft-365/onedrive/download"); + + return true; + } + } + catch (Exception ex) + { logger.Log("{0}", ex.Message); } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/System/RemoveW11Watermark.cs b/src/BloatyNosy/Features/System/RemoveW11Watermark.cs new file mode 100644 index 0000000..7de1a4c --- /dev/null +++ b/src/BloatyNosy/Features/System/RemoveW11Watermark.cs @@ -0,0 +1,63 @@ +using BloatyNosy; +using Microsoft.Win32; + +namespace Features.Feature.System +{ + internal class RemoveW11Watermark : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Control Panel\UnsupportedHardwareNotificationCache"; + private const int desiredValue = 0; + + public override string ID() + { + return "[LOW] Remove Windows 11 System requirements watermark"; + } + + public override string Info() + { + return "Microsoft will display with Build 2257 a desktop watermark on devices where Windows 11 is running on unsupported hardware."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "SV2", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "SV2", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Watermark and the settings notification should be gone."); + logger.Log(keyName); + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + var RegKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\UnsupportedHardwareNotificationCache", true); + + RegKey.DeleteValue("SV2"); + logger.Log("- Watermark has been enabled again."); + + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/System/TPMCheck.cs b/src/BloatyNosy/Features/System/TPMCheck.cs new file mode 100644 index 0000000..e5b8023 --- /dev/null +++ b/src/BloatyNosy/Features/System/TPMCheck.cs @@ -0,0 +1,79 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.System +{ + internal class TPMCheck : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_LOCAL_MACHINE\SYSTEM\Setup\LabConfig"; + private const string keyName2 = @"HKEY_LOCAL_MACHINE\SYSTEM\Setup\MoSetup"; + private const int desiredValue = 1; + + public override string ID() + { + return "[LOW] Disable TPM 2.0 Check"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "BypassCPUCheck", desiredValue) && + RegistryHelper.IntEquals(keyName, "BypassStorageCheck", desiredValue) && + RegistryHelper.IntEquals(keyName, "BypassTPMCheck", desiredValue) && + RegistryHelper.IntEquals(keyName, "BypassRAMCheck", desiredValue) && + RegistryHelper.IntEquals(keyName, "BypassSecureBootCheck", desiredValue) && + RegistryHelper.IntEquals(keyName2, "AllowUpgradesWithUnsupportedTPMOrCPU", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "BypassCPUCheck", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName, "BypassStorageCheck", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName, "BypassTPMCheck", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName, "BypassRAMCheck", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName, "BypassSecureBootCheck", desiredValue, RegistryValueKind.DWord); + Registry.SetValue(keyName2, "AllowUpgradesWithUnsupportedTPMOrCPU", desiredValue, RegistryValueKind.DWord); + + logger.Log("- TPM 2.0 Check has been successfully disabled."); + logger.Log(keyName); + logger.Log(keyName2); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable TPM 2.0 Check {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.LocalMachine.OpenSubKey(@"SYSTEM\Setup\LabConfig", true).DeleteValue("BypassTPMCheck", false); + Registry.LocalMachine.OpenSubKey(@"SYSTEM\Setup\LabConfig", true).DeleteValue("BypassRAMCheck", false); + Registry.LocalMachine.OpenSubKey(@"SYSTEM\Setup\LabConfig", true).DeleteValue("BypassSecureBootCheck", false); + Registry.LocalMachine.OpenSubKey(@"SYSTEM\Setup\LabConfig", true).DeleteValue("BypassStorageCheck", false); + Registry.LocalMachine.OpenSubKey(@"SYSTEM\Setup\LabConfig", true).DeleteValue("BypassCPUCheck", false); + Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\Setup\MoSetup", "AllowUpgradesWithUnsupportedTPMOrCPU", "0", RegistryValueKind.DWord); + + logger.Log("- TPM 2.0 Check has been enabled again."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/System/TeamsAutostart.cs b/src/BloatyNosy/Features/System/TeamsAutostart.cs new file mode 100644 index 0000000..9634864 --- /dev/null +++ b/src/BloatyNosy/Features/System/TeamsAutostart.cs @@ -0,0 +1,72 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.System +{ + internal class TeamsAutostart : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; + private string desiredValue = string.Format("C:\\Users\\{0}\\AppData\\Local\\Microsoft\\Teams\\Update.exe --processStart \"Teams.exe\" --process-start-args \"--system-initiated", Environment.UserName); + + public override string ID() + { + return "[LOW] Disable Microsoft Teams on Startup"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + string AppValue = "com.squirrel.Teams.Teams"; + + if (Registry.GetValue(keyName, AppValue, null) == null) + { + logger.Log("Problem on System: [SOLVED] Teams AutoStart is already disabled."); + return false; + } + else + { + // logger.Log("Teams AutoStart is enabled."); + return true; + } + } + + public override bool DoFeature() + { + try + { + var RegKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); + RegKey.DeleteValue("com.squirrel.Teams.Teams"); + + logger.Log("- Teams AutoStart has been disabled."); + return true; + } + catch + { } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "com.squirrel.Teams.Teams", desiredValue, RegistryValueKind.String); + + logger.Log("- Teams AutoStart has been enabled again."); + logger.Log(keyName); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/System/XPSWriter.cs b/src/BloatyNosy/Features/System/XPSWriter.cs new file mode 100644 index 0000000..4cfc27d --- /dev/null +++ b/src/BloatyNosy/Features/System/XPSWriter.cs @@ -0,0 +1,78 @@ +using BloatyNosy; +using System.Management.Automation; + +namespace Features.Feature.System +{ + internal class XPSWriter : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + public override string ID() + { + return "[LOW] Remove XPS Documents Writer"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + string script = "Get-WindowsOptionalFeature -Online -FeatureName \"Printing-XPSServices-Features\""; + + PowerShell powerShell = PowerShell.Create(); + powerShell.AddScript(script); + + var results = powerShell.Invoke(); + + foreach (var item in results) + { + var Status = item.Members["State"].Value; + + if (Status.ToString() == "Enabled") + { + // logger.Log("XPS Documents Writer is installed."); + return true; + } + } + //logger.Log("XPS Documents Writer not found."); + + return false; + } + + public override bool DoFeature() + { + string script = "Disable-WindowsOptionalFeature -Online -FeatureName \"Printing-XPSServices-Features\" -NoRestart -WarningAction SilentlyContinue | Out-Null"; + PowerShell powerShell = PowerShell.Create(); + powerShell.AddScript(script); + var results = powerShell.Invoke(); + + if (powerShell.Streams.Error.Count > 0) + { + logger.Log("XPS Documents Writer not found."); + return false; + } + + logger.Log("- XPS Documents Writer has been successfully removed."); + return true; + } + + public override bool UndoFeature() + { + string script = "Enable-WindowsOptionalFeature -Online -FeatureName \"Printing-XPSServices-Features\" -NoRestart -WarningAction SilentlyContinue | Out-Null"; + PowerShell powerShell = PowerShell.Create(); + powerShell.AddScript(script); + + var results = powerShell.Invoke(); + if (powerShell.Streams.Error.Count > 0) + { + logger.Log("XPS Documents Writer could not be installed."); + return false; + } + + logger.Log("- XPS Documents Writer has been successfully installed."); + return true; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Taskbar/MostUsedApps.cs b/src/BloatyNosy/Features/Taskbar/MostUsedApps.cs new file mode 100644 index 0000000..4756305 --- /dev/null +++ b/src/BloatyNosy/Features/Taskbar/MostUsedApps.cs @@ -0,0 +1,63 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Taskbar +{ + internal class MostUsedApps : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer"; + private const int desiredValue = 2; + + public override string ID() + { + return "[LOW] Hide most used apps in start menu"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "ShowOrHideMostUsedApps", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "ShowOrHideMostUsedApps", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Most Used Apps has been disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable Most Used Apps {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + var RegKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Policies\Microsoft\Windows\Explorer", true); + RegKey.DeleteValue("ShowOrHideMostUsedApps"); + + logger.Log("- Most Used Apps has been set to default behavior."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Taskbar/StartmenuLayout.cs b/src/BloatyNosy/Features/Taskbar/StartmenuLayout.cs new file mode 100644 index 0000000..ab62e6a --- /dev/null +++ b/src/BloatyNosy/Features/Taskbar/StartmenuLayout.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Taskbar +{ + internal class StartmenuLayout : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; + private const int desiredValue = 1; + + public override string ID() + { + return "[MIDDLE] Pin more Apps on Start menu"; + } + + public override string Info() + { + return "This option is ONLY available in preview versions of Windows 11 Build 22509 or newer."; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "Start_Layout", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "Start_Layout", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Start menu layout is now showing more Pins."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not enable more Pins on Start menu.{0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "Start_Layout", 0, RegistryValueKind.DWord); + logger.Log("- Showing more Pins on Start menu has been enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Taskbar/TaskView.cs b/src/BloatyNosy/Features/Taskbar/TaskView.cs new file mode 100644 index 0000000..bda900f --- /dev/null +++ b/src/BloatyNosy/Features/Taskbar/TaskView.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Taskbar +{ + internal class TaskView : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; + private const int desiredValue = 0; + + public override string ID() + { + return "[LOW] Hide Task view button on taskbar"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "ShowTaskViewButton", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "ShowTaskViewButton", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Task view button has been disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable Task view button {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "ShowTaskViewButton", 1, RegistryValueKind.DWord); + logger.Log("- Task view button has been enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Taskbar/TaskbarChat.cs b/src/BloatyNosy/Features/Taskbar/TaskbarChat.cs new file mode 100644 index 0000000..c263692 --- /dev/null +++ b/src/BloatyNosy/Features/Taskbar/TaskbarChat.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Taskbar +{ + internal class TaskbarChat : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; + private const int desiredValue = 0; + + public override string ID() + { + return "[LOW] Hide Chat icon (Microsoft Teams) on taskbar"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "TaskbarMn", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "TaskbarMn", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Chat icon has been disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable chat icon {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "TaskbarMn", 1, RegistryValueKind.DWord); + logger.Log("- Chat icon has been enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Features/Taskbar/TaskbarSearch.cs b/src/BloatyNosy/Features/Taskbar/TaskbarSearch.cs new file mode 100644 index 0000000..737b8d4 --- /dev/null +++ b/src/BloatyNosy/Features/Taskbar/TaskbarSearch.cs @@ -0,0 +1,61 @@ +using BloatyNosy; +using Microsoft.Win32; +using System; + +namespace Features.Feature.Taskbar +{ + internal class TaskbarSearch : FeatureBase + { + private static readonly ErrorHelper logger = ErrorHelper.Instance; + + private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search"; + private const int desiredValue = 0; + + public override string ID() + { + return "[LOW] Hide Search icon on taskbar"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckFeature() + { + return !( + RegistryHelper.IntEquals(keyName, "SearchboxTaskbarMode", desiredValue) + ); + } + + public override bool DoFeature() + { + try + { + Registry.SetValue(keyName, "SearchboxTaskbarMode", desiredValue, RegistryValueKind.DWord); + + logger.Log("- Search icon has been disabled."); + logger.Log(keyName); + return true; + } + catch (Exception ex) + { logger.Log("Could not disable search icon {0}", ex.Message); } + + return false; + } + + public override bool UndoFeature() + { + try + { + Registry.SetValue(keyName, "SearchboxTaskbarMode", 1, RegistryValueKind.DWord); + logger.Log("- Search icon has been enabled."); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Views/AboutPageView.Designer.cs b/src/BloatyNosy/Views/AboutPageView.Designer.cs new file mode 100644 index 0000000..bf9c34c --- /dev/null +++ b/src/BloatyNosy/Views/AboutPageView.Designer.cs @@ -0,0 +1,289 @@ +namespace BloatyNosy +{ + partial class AboutPageView + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this._lblDev = new System.Windows.Forms.Label(); + this._lblWith = new System.Windows.Forms.Label(); + this._lblHeartFillEmoji = new System.Windows.Forms.Label(); + this._lblAssembly = new System.Windows.Forms.Label(); + this.lblAppMediaPayPal = new System.Windows.Forms.LinkLabel(); + this.lblAppMediaTwitter = new System.Windows.Forms.LinkLabel(); + this.lblAppMediaGitHub = new System.Windows.Forms.LinkLabel(); + this._lblAppName = new System.Windows.Forms.Label(); + this.btnBack = new System.Windows.Forms.Button(); + this.lblHeader = new System.Windows.Forms.Label(); + this._lblAboutInfo = new System.Windows.Forms.Label(); + this.btnAppMediaTweetIntent = new System.Windows.Forms.Button(); + this.lnkUpdateAvailable = new System.Windows.Forms.LinkLabel(); + this.btnHelp = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // _lblDev + // + this._lblDev.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._lblDev.AutoEllipsis = true; + this._lblDev.AutoSize = true; + this._lblDev.BackColor = System.Drawing.Color.White; + this._lblDev.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this._lblDev.ForeColor = System.Drawing.Color.Gray; + this._lblDev.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this._lblDev.Location = new System.Drawing.Point(127, 236); + this._lblDev.Name = "_lblDev"; + this._lblDev.Size = new System.Drawing.Size(78, 20); + this._lblDev.TabIndex = 187; + this._lblDev.Text = "Builtbybel"; + // + // _lblWith + // + this._lblWith.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._lblWith.AutoEllipsis = true; + this._lblWith.AutoSize = true; + this._lblWith.BackColor = System.Drawing.Color.White; + this._lblWith.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this._lblWith.ForeColor = System.Drawing.Color.Gray; + this._lblWith.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this._lblWith.Location = new System.Drawing.Point(63, 236); + this._lblWith.Name = "_lblWith"; + this._lblWith.Size = new System.Drawing.Size(38, 20); + this._lblWith.TabIndex = 186; + this._lblWith.Text = "with"; + // + // _lblHeartFillEmoji + // + this._lblHeartFillEmoji.BackColor = System.Drawing.Color.White; + this._lblHeartFillEmoji.Font = new System.Drawing.Font("Segoe Fluent Icons", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this._lblHeartFillEmoji.ForeColor = System.Drawing.Color.HotPink; + this._lblHeartFillEmoji.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this._lblHeartFillEmoji.Location = new System.Drawing.Point(99, 231); + this._lblHeartFillEmoji.Name = "_lblHeartFillEmoji"; + this._lblHeartFillEmoji.Size = new System.Drawing.Size(32, 25); + this._lblHeartFillEmoji.TabIndex = 185; + // + // _lblAssembly + // + this._lblAssembly.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._lblAssembly.AutoEllipsis = true; + this._lblAssembly.AutoSize = true; + this._lblAssembly.BackColor = System.Drawing.Color.White; + this._lblAssembly.Font = new System.Drawing.Font("Segoe UI Variable Text", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this._lblAssembly.ForeColor = System.Drawing.Color.Gray; + this._lblAssembly.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this._lblAssembly.Location = new System.Drawing.Point(63, 209); + this._lblAssembly.Name = "_lblAssembly"; + this._lblAssembly.Size = new System.Drawing.Size(51, 17); + this._lblAssembly.TabIndex = 184; + this._lblAssembly.Text = "Version"; + // + // lblAppMediaPayPal + // + this.lblAppMediaPayPal.ActiveLinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppMediaPayPal.AutoEllipsis = true; + this.lblAppMediaPayPal.Font = new System.Drawing.Font("Segoe UI Variable Text", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblAppMediaPayPal.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lblAppMediaPayPal.LinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppMediaPayPal.Location = new System.Drawing.Point(63, 352); + this.lblAppMediaPayPal.Name = "lblAppMediaPayPal"; + this.lblAppMediaPayPal.Size = new System.Drawing.Size(336, 22); + this.lblAppMediaPayPal.TabIndex = 181; + this.lblAppMediaPayPal.TabStop = true; + this.lblAppMediaPayPal.Text = "Donate to Belim from @builtbybel "; + this.lblAppMediaPayPal.VisitedLinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppMediaPayPal.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblAppMediaPayPal_LinkClicked); + // + // lblAppMediaTwitter + // + this.lblAppMediaTwitter.ActiveLinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppMediaTwitter.AutoEllipsis = true; + this.lblAppMediaTwitter.Font = new System.Drawing.Font("Segoe UI Variable Text", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblAppMediaTwitter.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lblAppMediaTwitter.LinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppMediaTwitter.Location = new System.Drawing.Point(63, 320); + this.lblAppMediaTwitter.Name = "lblAppMediaTwitter"; + this.lblAppMediaTwitter.Size = new System.Drawing.Size(336, 22); + this.lblAppMediaTwitter.TabIndex = 180; + this.lblAppMediaTwitter.TabStop = true; + this.lblAppMediaTwitter.Text = "Follow me on Twitter"; + this.lblAppMediaTwitter.VisitedLinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppMediaTwitter.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblAppMediaTwitter_LinkClicked); + // + // lblAppMediaGitHub + // + this.lblAppMediaGitHub.ActiveLinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppMediaGitHub.AutoEllipsis = true; + this.lblAppMediaGitHub.Font = new System.Drawing.Font("Segoe UI Variable Text", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblAppMediaGitHub.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lblAppMediaGitHub.LinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppMediaGitHub.Location = new System.Drawing.Point(63, 289); + this.lblAppMediaGitHub.Name = "lblAppMediaGitHub"; + this.lblAppMediaGitHub.Size = new System.Drawing.Size(336, 22); + this.lblAppMediaGitHub.TabIndex = 178; + this.lblAppMediaGitHub.TabStop = true; + this.lblAppMediaGitHub.Text = "Follow on GitHub"; + this.lblAppMediaGitHub.VisitedLinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppMediaGitHub.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblAppMediaGitHub_LinkClicked); + // + // _lblAppName + // + this._lblAppName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._lblAppName.AutoEllipsis = true; + this._lblAppName.AutoSize = true; + this._lblAppName.BackColor = System.Drawing.Color.White; + this._lblAppName.Font = new System.Drawing.Font("Segoe UI Variable Text", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this._lblAppName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this._lblAppName.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this._lblAppName.Location = new System.Drawing.Point(59, 173); + this._lblAppName.Name = "_lblAppName"; + this._lblAppName.Size = new System.Drawing.Size(237, 36); + this._lblAppName.TabIndex = 177; + this._lblAppName.Text = "Bloaty \'Nosy App"; + // + // btnBack + // + this.btnBack.FlatAppearance.BorderSize = 0; + this.btnBack.FlatAppearance.MouseOverBackColor = System.Drawing.Color.WhiteSmoke; + this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnBack.Font = new System.Drawing.Font("Segoe Fluent Icons", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnBack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btnBack.Location = new System.Drawing.Point(0, 0); + this.btnBack.Name = "btnBack"; + this.btnBack.Size = new System.Drawing.Size(42, 38); + this.btnBack.TabIndex = 178; + this.btnBack.Text = "..."; + this.btnBack.UseVisualStyleBackColor = true; + this.btnBack.Click += new System.EventHandler(this.btnBack_Click); + // + // lblHeader + // + this.lblHeader.AutoEllipsis = true; + this.lblHeader.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblHeader.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.lblHeader.Location = new System.Drawing.Point(60, 4); + this.lblHeader.Name = "lblHeader"; + this.lblHeader.Size = new System.Drawing.Size(588, 32); + this.lblHeader.TabIndex = 189; + this.lblHeader.Text = "Settings"; + // + // _lblAboutInfo + // + this._lblAboutInfo.AutoEllipsis = true; + this._lblAboutInfo.AutoSize = true; + this._lblAboutInfo.Font = new System.Drawing.Font("Segoe UI Variable Display", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this._lblAboutInfo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this._lblAboutInfo.Location = new System.Drawing.Point(62, 143); + this._lblAboutInfo.Name = "_lblAboutInfo"; + this._lblAboutInfo.Size = new System.Drawing.Size(100, 17); + this._lblAboutInfo.TabIndex = 190; + this._lblAboutInfo.Text = "About this App"; + // + // btnAppMediaTweetIntent + // + this.btnAppMediaTweetIntent.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnAppMediaTweetIntent.Location = new System.Drawing.Point(67, 403); + this.btnAppMediaTweetIntent.Name = "btnAppMediaTweetIntent"; + this.btnAppMediaTweetIntent.Size = new System.Drawing.Size(149, 32); + this.btnAppMediaTweetIntent.TabIndex = 191; + this.btnAppMediaTweetIntent.Text = "Tweet"; + this.btnAppMediaTweetIntent.UseVisualStyleBackColor = true; + this.btnAppMediaTweetIntent.Click += new System.EventHandler(this.btnAppMediaTweetIntent_Click); + // + // lnkUpdateAvailable + // + this.lnkUpdateAvailable.ActiveLinkColor = System.Drawing.Color.DeepPink; + this.lnkUpdateAvailable.AutoEllipsis = true; + this.lnkUpdateAvailable.AutoSize = true; + this.lnkUpdateAvailable.BackColor = System.Drawing.Color.Turquoise; + this.lnkUpdateAvailable.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lnkUpdateAvailable.LinkColor = System.Drawing.Color.Black; + this.lnkUpdateAvailable.Location = new System.Drawing.Point(188, 209); + this.lnkUpdateAvailable.Name = "lnkUpdateAvailable"; + this.lnkUpdateAvailable.Size = new System.Drawing.Size(17, 17); + this.lnkUpdateAvailable.TabIndex = 195; + this.lnkUpdateAvailable.TabStop = true; + this.lnkUpdateAvailable.Text = "..."; + this.lnkUpdateAvailable.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkUpdateAvailable_LinkClicked); + // + // btnHelp + // + this.btnHelp.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnHelp.Location = new System.Drawing.Point(67, 451); + this.btnHelp.Name = "btnHelp"; + this.btnHelp.Size = new System.Drawing.Size(134, 32); + this.btnHelp.TabIndex = 196; + this.btnHelp.Text = "Help"; + this.btnHelp.UseVisualStyleBackColor = true; + this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click); + // + // AboutPageView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.AutoScroll = true; + this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.btnHelp); + this.Controls.Add(this.lnkUpdateAvailable); + this.Controls.Add(this.btnAppMediaTweetIntent); + this.Controls.Add(this._lblAboutInfo); + this.Controls.Add(this.lblHeader); + this.Controls.Add(this.btnBack); + this.Controls.Add(this._lblDev); + this.Controls.Add(this._lblWith); + this.Controls.Add(this._lblAppName); + this.Controls.Add(this._lblHeartFillEmoji); + this.Controls.Add(this.lblAppMediaGitHub); + this.Controls.Add(this._lblAssembly); + this.Controls.Add(this.lblAppMediaTwitter); + this.Controls.Add(this.lblAppMediaPayPal); + this.Name = "AboutPageView"; + this.Size = new System.Drawing.Size(1054, 795); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Button btnBack; + private System.Windows.Forms.Label _lblDev; + private System.Windows.Forms.Label _lblWith; + private System.Windows.Forms.Label _lblHeartFillEmoji; + private System.Windows.Forms.Label _lblAssembly; + private System.Windows.Forms.LinkLabel lblAppMediaPayPal; + private System.Windows.Forms.LinkLabel lblAppMediaTwitter; + private System.Windows.Forms.LinkLabel lblAppMediaGitHub; + private System.Windows.Forms.Label _lblAppName; + private System.Windows.Forms.Label lblHeader; + private System.Windows.Forms.Label _lblAboutInfo; + private System.Windows.Forms.Button btnAppMediaTweetIntent; + private System.Windows.Forms.LinkLabel lnkUpdateAvailable; + private System.Windows.Forms.Button btnHelp; + } +} diff --git a/src/BloatyNosy/Views/AboutPageView.cs b/src/BloatyNosy/Views/AboutPageView.cs new file mode 100644 index 0000000..216a9e5 --- /dev/null +++ b/src/BloatyNosy/Views/AboutPageView.cs @@ -0,0 +1,121 @@ +using HelperTool; +using System; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Net; +using System.Windows.Forms; + +namespace BloatyNosy +{ + public partial class AboutPageView : UserControl + { + public AboutPageView() + { + InitializeComponent(); + + SetStyle(); + CheckForUpdates(); + } + + // Some UI nicety + private void SetStyle() + { + BackColor = + _lblAppName.BackColor = + _lblAssembly.BackColor = + _lblWith.BackColor = + _lblHeartFillEmoji.BackColor = + _lblDev.BackColor = + Color.FromArgb(245, 241, 249); + + btnBack.Text = "\uE72B"; + _lblAssembly.Text = "Version " + Program.GetCurrentVersionTostring(); + _lblHeartFillEmoji.Text = "\uEB52"; + } + + public void CheckForUpdates() + { + if (IsInet() == true) + { + try + { + string assemblyInfo = new WebClient().DownloadString(Utils.Uri.URL_ASSEMBLY); + + var readVersion = assemblyInfo.Split('\n'); + var infoVersion = readVersion.Where(t => t.Contains("[assembly: AssemblyFileVersion")); + var latestVersion = ""; + foreach (var item in infoVersion) + { + latestVersion = item.Substring(item.IndexOf('(') + 2, item.LastIndexOf(')') - item.IndexOf('(') - 3); + } + + if (latestVersion == + Program.GetCurrentVersionTostring()) // Up-to-date + { + //logger.Log("No new release found."); + lnkUpdateAvailable.Visible = false; + } + + if (latestVersion != // Update available + Program.GetCurrentVersionTostring()) + + { + lnkUpdateAvailable.Text = $"App version {latestVersion} available."; + } + } + catch (Exception ex) + { + lnkUpdateAvailable.Text = $"Checking for App updates failed.\n{ex.Message}"; + } + } + else if (IsInet() == false) + { + lnkUpdateAvailable.Text = $"Problem on Internet connection: Checking for App updates failed"; + } + } + + // Check Inet + public static bool IsInet() + { + try + { + using (var CheckInternet = new WebClient()) + using (CheckInternet.OpenRead("http://clients3.google.com/generate_204")) + { + return true; + } + } + catch + { + return false; + } + } + + private void btnBack_Click(object sender, System.EventArgs e) + { + var mainForm = Application.OpenForms.OfType().Single(); + mainForm.pnlForm.Controls.Clear(); + if (mainForm.INavPage != null) mainForm.pnlForm.Controls.Add(mainForm.INavPage); + } + + private void lblAppMediaGitHub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + => Process.Start(HelperTool.Utils.Uri.URL_GITREPO); + + private void lblAppMediaTwitter_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + => Process.Start(HelperTool.Utils.Uri.URL_TWITTER); + + private void lblAppMediaPayPal_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + => Process.Start(HelperTool.Utils.Uri.URL_DONATE); + + private void btnAppMediaTweetIntent_Click(object sender, System.EventArgs e) + => Process.Start(HelperTool.Utils.TweetIntent); + + private void lnkUpdateAvailable_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + => Utils.LaunchUri(Utils.Uri.URL_GITLATEST); + + private void btnHelp_Click(object sender, EventArgs e) + => Process.Start(HelperTool.Utils.Uri.URL_HELP); + + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Views/AboutPageView.resx b/src/BloatyNosy/Views/AboutPageView.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/src/BloatyNosy/Views/AboutPageView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/BloatyNosy/Views/AppsPageView.Designer.cs b/src/BloatyNosy/Views/AppsPageView.Designer.cs new file mode 100644 index 0000000..1542616 --- /dev/null +++ b/src/BloatyNosy/Views/AppsPageView.Designer.cs @@ -0,0 +1,413 @@ +namespace BloatyNosy +{ + partial class AppsPageView + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.ToolStripMenuItem menuAppsExport; + this.listRemove = new System.Windows.Forms.ListBox(); + this.rtbStatus = new System.Windows.Forms.RichTextBox(); + this.btnRefresh = new System.Windows.Forms.Button(); + this.btnRestoreAll = new System.Windows.Forms.Button(); + this.btnRestore = new System.Windows.Forms.Button(); + this.btnMoveAll = new System.Windows.Forms.Button(); + this.btnMove = new System.Windows.Forms.Button(); + this.btnUninstall = new System.Windows.Forms.Button(); + this.btnBack = new System.Windows.Forms.Button(); + this.lblHeader = new System.Windows.Forms.Label(); + this.listApps = new System.Windows.Forms.ListBox(); + this.checkAppsSystem = new System.Windows.Forms.CheckBox(); + this.groupBin = new System.Windows.Forms.GroupBox(); + this.lblAppsBinOptions = new System.Windows.Forms.LinkLabel(); + this.groupInstalled = new System.Windows.Forms.GroupBox(); + this.textSearch = new System.Windows.Forms.TextBox(); + this.btnHMenu = new System.Windows.Forms.Button(); + this.contextAppMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.menuAppsImport = new System.Windows.Forms.ToolStripMenuItem(); + this.menuAppsRemoveAll = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.menuSyncCommunity = new System.Windows.Forms.ToolStripMenuItem(); + menuAppsExport = new System.Windows.Forms.ToolStripMenuItem(); + this.groupBin.SuspendLayout(); + this.groupInstalled.SuspendLayout(); + this.contextAppMenu.SuspendLayout(); + this.SuspendLayout(); + // + // menuAppsExport + // + menuAppsExport.Name = "menuAppsExport"; + menuAppsExport.Size = new System.Drawing.Size(337, 22); + menuAppsExport.Text = "Export bloatware in bin"; + menuAppsExport.Click += new System.EventHandler(this.menuAppsExport_Click); + // + // listRemove + // + this.listRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listRemove.BackColor = System.Drawing.Color.White; + this.listRemove.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listRemove.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listRemove.FormattingEnabled = true; + this.listRemove.ItemHeight = 17; + this.listRemove.Location = new System.Drawing.Point(11, 36); + this.listRemove.Name = "listRemove"; + this.listRemove.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; + this.listRemove.Size = new System.Drawing.Size(394, 595); + this.listRemove.Sorted = true; + this.listRemove.TabIndex = 13; + // + // rtbStatus + // + this.rtbStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.rtbStatus.BackColor = System.Drawing.Color.White; + this.rtbStatus.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.rtbStatus.Font = new System.Drawing.Font("Segoe UI Variable Text", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtbStatus.ForeColor = System.Drawing.Color.Black; + this.rtbStatus.HideSelection = false; + this.rtbStatus.Location = new System.Drawing.Point(11, 66); + this.rtbStatus.Name = "rtbStatus"; + this.rtbStatus.ReadOnly = true; + this.rtbStatus.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; + this.rtbStatus.Size = new System.Drawing.Size(393, 570); + this.rtbStatus.TabIndex = 139; + this.rtbStatus.Text = ""; + this.rtbStatus.Visible = false; + // + // btnRefresh + // + this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnRefresh.BackColor = System.Drawing.Color.MediumVioletRed; + this.btnRefresh.FlatAppearance.BorderColor = System.Drawing.Color.Orchid; + this.btnRefresh.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnRefresh.Font = new System.Drawing.Font("Segoe Fluent Icons", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnRefresh.ForeColor = System.Drawing.Color.White; + this.btnRefresh.Location = new System.Drawing.Point(977, 49); + this.btnRefresh.Name = "btnRefresh"; + this.btnRefresh.Size = new System.Drawing.Size(31, 30); + this.btnRefresh.TabIndex = 38; + this.btnRefresh.Text = "Refresh"; + this.btnRefresh.UseVisualStyleBackColor = false; + this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); + // + // btnRestoreAll + // + this.btnRestoreAll.Font = new System.Drawing.Font("Segoe UI Variable Text", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnRestoreAll.ForeColor = System.Drawing.Color.Black; + this.btnRestoreAll.Location = new System.Drawing.Point(482, 313); + this.btnRestoreAll.Name = "btnRestoreAll"; + this.btnRestoreAll.Size = new System.Drawing.Size(89, 23); + this.btnRestoreAll.TabIndex = 34; + this.btnRestoreAll.Text = "<< Restore all"; + this.btnRestoreAll.UseVisualStyleBackColor = true; + this.btnRestoreAll.Click += new System.EventHandler(this.btnRestoreAll_Click); + // + // btnRestore + // + this.btnRestore.Font = new System.Drawing.Font("Segoe UI Variable Text", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnRestore.ForeColor = System.Drawing.Color.Black; + this.btnRestore.Location = new System.Drawing.Point(482, 342); + this.btnRestore.Name = "btnRestore"; + this.btnRestore.Size = new System.Drawing.Size(89, 23); + this.btnRestore.TabIndex = 32; + this.btnRestore.Text = "< Restore"; + this.btnRestore.UseVisualStyleBackColor = true; + this.btnRestore.Click += new System.EventHandler(this.btnRestore_Click); + // + // btnMoveAll + // + this.btnMoveAll.Font = new System.Drawing.Font("Segoe UI Variable Text", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnMoveAll.ForeColor = System.Drawing.Color.Black; + this.btnMoveAll.Location = new System.Drawing.Point(482, 201); + this.btnMoveAll.Name = "btnMoveAll"; + this.btnMoveAll.Size = new System.Drawing.Size(89, 23); + this.btnMoveAll.TabIndex = 35; + this.btnMoveAll.Text = "Move all >>"; + this.btnMoveAll.UseVisualStyleBackColor = true; + this.btnMoveAll.Click += new System.EventHandler(this.btnMoveAll_Click); + // + // btnMove + // + this.btnMove.Font = new System.Drawing.Font("Segoe UI Variable Text", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnMove.ForeColor = System.Drawing.Color.Black; + this.btnMove.Location = new System.Drawing.Point(482, 230); + this.btnMove.Name = "btnMove"; + this.btnMove.Size = new System.Drawing.Size(89, 23); + this.btnMove.TabIndex = 31; + this.btnMove.Text = "Move >"; + this.btnMove.UseVisualStyleBackColor = true; + this.btnMove.Click += new System.EventHandler(this.btnMove_Click); + // + // btnUninstall + // + this.btnUninstall.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnUninstall.BackColor = System.Drawing.Color.MediumVioletRed; + this.btnUninstall.FlatAppearance.BorderColor = System.Drawing.Color.Orchid; + this.btnUninstall.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnUninstall.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnUninstall.ForeColor = System.Drawing.Color.White; + this.btnUninstall.Location = new System.Drawing.Point(797, 49); + this.btnUninstall.Name = "btnUninstall"; + this.btnUninstall.Size = new System.Drawing.Size(181, 30); + this.btnUninstall.TabIndex = 41; + this.btnUninstall.Text = "Empty bin and remove apps"; + this.btnUninstall.UseVisualStyleBackColor = false; + this.btnUninstall.Click += new System.EventHandler(this.btnUninstall_Click); + // + // btnBack + // + this.btnBack.FlatAppearance.BorderSize = 0; + this.btnBack.FlatAppearance.MouseOverBackColor = System.Drawing.Color.WhiteSmoke; + this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnBack.Font = new System.Drawing.Font("Segoe Fluent Icons", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnBack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btnBack.Location = new System.Drawing.Point(0, 0); + this.btnBack.Name = "btnBack"; + this.btnBack.Size = new System.Drawing.Size(42, 38); + this.btnBack.TabIndex = 176; + this.btnBack.Text = "..."; + this.btnBack.UseVisualStyleBackColor = true; + this.btnBack.Click += new System.EventHandler(this.btnBack_Click); + // + // lblHeader + // + this.lblHeader.AutoEllipsis = true; + this.lblHeader.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblHeader.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.lblHeader.Location = new System.Drawing.Point(80, 4); + this.lblHeader.Name = "lblHeader"; + this.lblHeader.Size = new System.Drawing.Size(960, 32); + this.lblHeader.TabIndex = 177; + this.lblHeader.Text = "BloatFinder"; + // + // listApps + // + this.listApps.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listApps.BackColor = System.Drawing.Color.White; + this.listApps.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listApps.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listApps.FormattingEnabled = true; + this.listApps.ItemHeight = 17; + this.listApps.Location = new System.Drawing.Point(11, 36); + this.listApps.Name = "listApps"; + this.listApps.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; + this.listApps.Size = new System.Drawing.Size(394, 595); + this.listApps.Sorted = true; + this.listApps.TabIndex = 13; + // + // checkAppsSystem + // + this.checkAppsSystem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.checkAppsSystem.AutoSize = true; + this.checkAppsSystem.FlatAppearance.BorderSize = 0; + this.checkAppsSystem.Font = new System.Drawing.Font("Segoe UI Variable Text", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkAppsSystem.ForeColor = System.Drawing.Color.DeepPink; + this.checkAppsSystem.Location = new System.Drawing.Point(35, 744); + this.checkAppsSystem.Name = "checkAppsSystem"; + this.checkAppsSystem.Size = new System.Drawing.Size(135, 21); + this.checkAppsSystem.TabIndex = 16; + this.checkAppsSystem.Text = "Show system apps"; + this.checkAppsSystem.UseVisualStyleBackColor = true; + this.checkAppsSystem.CheckedChanged += new System.EventHandler(this.checkAppsSystem_CheckedChanged); + // + // groupBin + // + this.groupBin.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBin.Controls.Add(this.lblAppsBinOptions); + this.groupBin.Controls.Add(this.listRemove); + this.groupBin.Controls.Add(this.rtbStatus); + this.groupBin.Font = new System.Drawing.Font("Segoe UI Variable Text", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBin.ForeColor = System.Drawing.Color.DeepPink; + this.groupBin.Location = new System.Drawing.Point(609, 82); + this.groupBin.Name = "groupBin"; + this.groupBin.Size = new System.Drawing.Size(411, 648); + this.groupBin.TabIndex = 39; + this.groupBin.TabStop = false; + this.groupBin.Text = "Recycle bin"; + // + // lblAppsBinOptions + // + this.lblAppsBinOptions.ActiveLinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppsBinOptions.AutoEllipsis = true; + this.lblAppsBinOptions.AutoSize = true; + this.lblAppsBinOptions.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblAppsBinOptions.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lblAppsBinOptions.LinkColor = System.Drawing.Color.Black; + this.lblAppsBinOptions.Location = new System.Drawing.Point(8, 36); + this.lblAppsBinOptions.Name = "lblAppsBinOptions"; + this.lblAppsBinOptions.Size = new System.Drawing.Size(318, 16); + this.lblAppsBinOptions.TabIndex = 159; + this.lblAppsBinOptions.TabStop = true; + this.lblAppsBinOptions.Text = "Move the apps you want to uninstall here or import via file."; + this.lblAppsBinOptions.VisitedLinkColor = System.Drawing.Color.MediumVioletRed; + this.lblAppsBinOptions.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblAppsBinOptions_LinkClicked); + // + // groupInstalled + // + this.groupInstalled.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.groupInstalled.Controls.Add(this.listApps); + this.groupInstalled.Font = new System.Drawing.Font("Segoe UI Variable Text", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupInstalled.ForeColor = System.Drawing.Color.Violet; + this.groupInstalled.Location = new System.Drawing.Point(28, 82); + this.groupInstalled.Name = "groupInstalled"; + this.groupInstalled.Size = new System.Drawing.Size(411, 648); + this.groupInstalled.TabIndex = 40; + this.groupInstalled.TabStop = false; + this.groupInstalled.Text = "Installed apps"; + // + // textSearch + // + this.textSearch.BackColor = System.Drawing.Color.WhiteSmoke; + this.textSearch.Font = new System.Drawing.Font("Segoe UI Variable Text", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textSearch.ForeColor = System.Drawing.Color.Gray; + this.textSearch.Location = new System.Drawing.Point(469, 29); + this.textSearch.Name = "textSearch"; + this.textSearch.Size = new System.Drawing.Size(122, 23); + this.textSearch.TabIndex = 181; + this.textSearch.Text = "Search..."; + this.textSearch.Click += new System.EventHandler(this.textSearch_Click); + this.textSearch.TextChanged += new System.EventHandler(this.textSearch_TextChanged); + // + // btnHMenu + // + this.btnHMenu.FlatAppearance.BorderSize = 0; + this.btnHMenu.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gainsboro; + this.btnHMenu.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnHMenu.Font = new System.Drawing.Font("Segoe Fluent Icons", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnHMenu.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btnHMenu.Location = new System.Drawing.Point(35, 0); + this.btnHMenu.Name = "btnHMenu"; + this.btnHMenu.Size = new System.Drawing.Size(42, 38); + this.btnHMenu.TabIndex = 184; + this.btnHMenu.Text = "..."; + this.btnHMenu.UseVisualStyleBackColor = true; + this.btnHMenu.Click += new System.EventHandler(this.btnHMenu_Click); + // + // contextAppMenu + // + this.contextAppMenu.BackColor = System.Drawing.Color.WhiteSmoke; + this.contextAppMenu.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.contextAppMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuAppsImport, + menuAppsExport, + this.menuAppsRemoveAll, + this.toolStripSeparator1, + this.menuSyncCommunity}); + this.contextAppMenu.Name = "menuMain"; + this.contextAppMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.contextAppMenu.Size = new System.Drawing.Size(338, 98); + this.contextAppMenu.Text = "Info"; + // + // menuAppsImport + // + this.menuAppsImport.Name = "menuAppsImport"; + this.menuAppsImport.Size = new System.Drawing.Size(337, 22); + this.menuAppsImport.Text = "Import bloatware list"; + this.menuAppsImport.Click += new System.EventHandler(this.menuAppsImport_Click); + // + // menuAppsRemoveAll + // + this.menuAppsRemoveAll.Name = "menuAppsRemoveAll"; + this.menuAppsRemoveAll.Size = new System.Drawing.Size(337, 22); + this.menuAppsRemoveAll.Text = "Uninstall all apps"; + this.menuAppsRemoveAll.Click += new System.EventHandler(this.menuAppsRemoveAll_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(334, 6); + // + // menuSyncCommunity + // + this.menuSyncCommunity.Name = "menuSyncCommunity"; + this.menuSyncCommunity.Size = new System.Drawing.Size(337, 22); + this.menuSyncCommunity.Text = "Sync bloatware with community list (Slasher Mode)"; + this.menuSyncCommunity.Click += new System.EventHandler(this.menuSyncCommunity_Click); + // + // AppsPageView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.AutoScroll = true; + this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.checkAppsSystem); + this.Controls.Add(this.btnHMenu); + this.Controls.Add(this.textSearch); + this.Controls.Add(this.lblHeader); + this.Controls.Add(this.btnBack); + this.Controls.Add(this.btnUninstall); + this.Controls.Add(this.groupBin); + this.Controls.Add(this.btnRefresh); + this.Controls.Add(this.btnRestoreAll); + this.Controls.Add(this.groupInstalled); + this.Controls.Add(this.btnRestore); + this.Controls.Add(this.btnMoveAll); + this.Controls.Add(this.btnMove); + this.Name = "AppsPageView"; + this.Size = new System.Drawing.Size(1054, 795); + this.groupBin.ResumeLayout(false); + this.groupBin.PerformLayout(); + this.groupInstalled.ResumeLayout(false); + this.contextAppMenu.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.ListBox listRemove; + private System.Windows.Forms.Button btnRefresh; + private System.Windows.Forms.Button btnRestoreAll; + private System.Windows.Forms.Button btnRestore; + private System.Windows.Forms.Button btnMoveAll; + private System.Windows.Forms.Button btnMove; + private System.Windows.Forms.Button btnUninstall; + public System.Windows.Forms.RichTextBox rtbStatus; + private System.Windows.Forms.Button btnBack; + private System.Windows.Forms.Label lblHeader; + private System.Windows.Forms.ListBox listApps; + private System.Windows.Forms.CheckBox checkAppsSystem; + private System.Windows.Forms.GroupBox groupBin; + private System.Windows.Forms.GroupBox groupInstalled; + private System.Windows.Forms.TextBox textSearch; + private System.Windows.Forms.LinkLabel lblAppsBinOptions; + private System.Windows.Forms.Button btnHMenu; + private System.Windows.Forms.ContextMenuStrip contextAppMenu; + private System.Windows.Forms.ToolStripMenuItem menuAppsImport; + private System.Windows.Forms.ToolStripMenuItem menuAppsRemoveAll; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem menuSyncCommunity; + } +} diff --git a/src/BloatyNosy/Views/AppsPageView.cs b/src/BloatyNosy/Views/AppsPageView.cs new file mode 100644 index 0000000..c9b5f2b --- /dev/null +++ b/src/BloatyNosy/Views/AppsPageView.cs @@ -0,0 +1,426 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace BloatyNosy +{ + public partial class AppsPageView : UserControl + { + private List removeAppsList = new List(); + private List removeAppsFailedList = new List(); + private List removeAppsSystem = new List(); + + private readonly PowerShell powerShell = PowerShell.Create(); + + public AppsPageView() + { + InitializeComponent(); + + this.InitializeAppsSystem(); // Retrieve hidden systemapps from resource file + this.InitializeApps(); // Yet just the normal.... + + SetStyle(); + } + + // Some UI nicety + private void SetStyle() + { + BackColor = + listApps.BackColor = + listRemove.BackColor = + rtbStatus.BackColor = + Color.FromArgb(245, 241, 249); + + btnHMenu.Text = "\uE700"; + btnBack.Text = "\uE72B"; + btnRefresh.Text = "\uE72C"; + } + + private void InitializeApps() + { + listApps.Items.Clear(); + powerShell.Commands.Clear(); + powerShell.AddCommand("get-appxpackage"); + powerShell.AddCommand("Select").AddParameter("property", "name"); + + foreach (PSObject result in powerShell.Invoke()) + { + string current = result.ToString(); + // Show ONLY NON-SYSTEM apps by comparing found apps with systemapps.txt + if (removeAppsSystem != null) if ((removeAppsSystem.Any(current.Contains)) & !checkAppsSystem.Checked) continue; + + if (listApps.Items.Contains(Regex.Replace(current, "(@{Name=)|(})", ""))) continue; + listApps.Items.Add(Regex.Replace(current, "(@{Name=)|(})", "")); + removeAppsList.Add(Regex.Replace(current, "(@{Name=)|(})", "")); + } + + // Compare left and rights apps list and remove differences + string compare = listApps.Items.ToString(); + foreach (string item in listRemove.Items) if (item.Any(compare.Contains)) listApps.Items.Remove(item); + + RefreshApps(); + } + + private void InitializeAppsSystem() + { + StreamReader Database = null; + + try + { + HelperTool.Utils.CreateDataDir(); + Database = File.OpenText(HelperTool.Utils.Data.DataRootDir + "systemApps.txt"); + } + catch (FileNotFoundException) // Create file if it doesnt exisits + { + StreamWriter sw = File.CreateText(HelperTool.Utils.Data.DataRootDir + "systemApps.txt"); + sw.Write(BloatyNosy.Properties.Resources.systemApps); // Populate it with built in preset + sw.Close(); + + Database = File.OpenText(HelperTool.Utils.Data.DataRootDir + "systemApps.txt"); + } + finally + { + if (Database.Peek() > 0) // Exists and not empty + { + string buff; + while ((buff = Database.ReadLine()) != null) + { + removeAppsSystem.Add(buff); + } + }; + Database.Close(); + } + } + + private void RemoveApps(string app) + { + bool error = false; + + using (PowerShell script = PowerShell.Create()) + { + script.AddScript("Get-AppxPackage " + app + " | Remove-AppxPackage"); + + script.Invoke(); + error = script.HadErrors; + } + + if (error) + { + removeAppsFailedList.Add(app); + } + else + { + removeAppsList.Add(app); + } + + return; + } + + private void RefreshApps() + { + int installed = listApps.Items.Count; + int remove = listRemove.Items.Count; + groupInstalled.Text = installed.ToString() + " apps installed"; + groupBin.Text = "Recycle bin" + " (" + remove.ToString() + ")"; + + if (listRemove.Items.Count == 0) + { + rtbStatus.Visible = true; + lblAppsBinOptions.Visible = true; + listRemove.Visible = false; + } + else + { + listRemove.Visible = true; + lblAppsBinOptions.Visible = false; + rtbStatus.Visible = false; + } + + if (installed == 0) + btnMoveAll.Enabled = + btnMove.Enabled = + false; + else + btnMoveAll.Enabled = + btnMove.Enabled = + true; + + if (remove == 0) + btnRestoreAll.Enabled = + btnRestore.Enabled = + false; + else + btnRestoreAll.Enabled = + btnRestore.Enabled = + true; + } + + private void btnRefresh_Click(object sender, EventArgs e) + { + listApps.Items.Clear(); + listRemove.Items.Clear(); + removeAppsList.Clear(); + + InitializeAppsSystem(); + InitializeApps(); + } + + private void btnRestoreAll_Click(object sender, EventArgs e) + { + foreach (var item in listRemove.Items) + { + listApps.Items.Add(item); + } + listRemove.Items.Clear(); + RefreshApps(); + } + + private void btnRestore_Click(object sender, EventArgs e) + { + if (listRemove.Items.Count != 0) + { + if (listRemove.SelectedItem == null) listRemove.SelectedIndex = 0; + while (listRemove.SelectedItem != null) + { + listApps.Items.Add(listRemove.SelectedItem); + listRemove.Items.Remove(listRemove.SelectedItem); + } + RefreshApps(); + } + } + + private void btnMoveAll_Click(object sender, EventArgs e) + { + foreach (var item in listApps.Items) + { + listRemove.Items.Add(item); + } + listApps.Items.Clear(); + RefreshApps(); + } + + private void btnMove_Click(object sender, EventArgs e) + { + if (listApps.Items.Count != 0) + { + if (listApps.SelectedItem == null) listApps.SelectedIndex = 0; + while (listApps.SelectedItem != null) + { + listRemove.Items.Add(listApps.SelectedItem); + listApps.Items.Remove(listApps.SelectedItem); + } + RefreshApps(); + } + } + + private void checkAppsSystem_CheckedChanged(object sender, EventArgs e) + { + if (checkAppsSystem.Checked) + { + MessageBox.Show("Be picky about which System applications to uninstall." + + "\n\nYou can uninstall most of the built-in apps, even ones that don't normally offer an \"Uninstall\" option." + + "\n\nNote, however, this app won't allow you to remove a few of the most important built-in apps, like Microsoft Edge, .NET framework, UI.Xaml etc. " + + "as these apps are needed for the Windows 11 \"Experience\" and for other programs. If you try, you’ll see an error message saying the removal failed."); + + removeAppsList.Clear(); + InitializeAppsSystem(); + InitializeApps(); + } + else + { + removeAppsList.Clear(); InitializeApps(); + } + } + + private async void btnUninstall_Click(object sender, EventArgs e) + { + string selectedApps = string.Empty; + string successList = string.Empty; + string failedList = string.Empty; + + foreach (string app in listRemove.Items) + { + selectedApps += app + Environment.NewLine; + } + if (MessageBox.Show("Do you want to empty the Recycle bin and delete all apps in it?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + removeAppsList.Clear(); + removeAppsFailedList.Clear(); + rtbStatus.Visible = true; + rtbStatus.Clear(); + listRemove.Visible = false; + btnUninstall.Enabled = false; + + foreach (string app in listRemove.Items) + { + rtbStatus.Text += Environment.NewLine + "Uninstalling " + app.ToString(); + + await Task.Run(() => RemoveApps(app)); + } + + foreach (var str in removeAppsList) + { + successList += "-" + str + Environment.NewLine; + } + foreach (var str in removeAppsFailedList) + { + failedList += "-" + str + Environment.NewLine; + } + + // Summary removal process + string message = string.Format("Summary:\n{0} app(s) has been selected for removal.\n{1} app(s) has been removed.", + removeAppsList.Count + removeAppsFailedList.Count, removeAppsList.Count) + Environment.NewLine + Environment.NewLine; + + if (removeAppsList.Count != 0) + { + message += "The folowing app(s) have been removed successfully:" + Environment.NewLine + successList + Environment.NewLine; + } + + if (removeAppsFailedList.Count != 0) + { + message += "The following app(s) could not be removed: " + Environment.NewLine + failedList; + message += Environment.NewLine + "Note, however, this app won't allow you to remove a few of the most important built-in apps, like Microsoft Edge, .NET framework, UI.Xaml etc. " + + "as these apps are needed for the Windows 11 Experience and for other programs. If you try, you’ll see an error message saying the removal failed."; + } + + btnRefresh.PerformClick(); + + btnUninstall.Enabled = true; + rtbStatus.Text = message + Environment.NewLine; + rtbStatus.Text += Environment.NewLine + listApps.Items.Count + " apps are left.\n"; + } + } + + private void btnBack_Click(object sender, EventArgs e) + { + var mainForm = Application.OpenForms.OfType().Single(); + mainForm.pnlForm.Controls.Clear(); + if (mainForm.INavPage != null) mainForm.pnlForm.Controls.Add(mainForm.INavPage); + } + + private void textSearch_TextChanged(object sender, EventArgs e) + { + listApps.Items.Clear(); + + foreach (string str in removeAppsList) + { + if (str.IndexOf(textSearch.Text, 0, StringComparison.CurrentCultureIgnoreCase) != -1) + { + listApps.Items.Add(str); + } + } + } + + private void textSearch_Click(object sender, EventArgs e) + => textSearch.Text = ""; + + private void menuAppsImport_Click(object sender, EventArgs e) + { + OpenFileDialog f = new OpenFileDialog(); + f.InitialDirectory = HelperTool.Utils.Data.DataRootDir; + + if (f.ShowDialog() == DialogResult.OK) + + { + List lines = new List(); + using (StreamReader r = new StreamReader(f.OpenFile())) + { + listRemove.Items.Clear(); + + string line; + while ((line = r.ReadLine()) != null) + { + listRemove.Items.Add(line); + RefreshApps(); + string compare = listApps.Items.ToString(); + foreach (string item in listRemove.Items) if (item.Any(compare.Contains)) listApps.Items.Remove(item); + } + + RefreshApps(); + + MessageBox.Show("We've synced your import list with the apps in Recycle bin.\n" + + "Please note, that some of these apps may not be installed on your system.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + + private void menuAppsExport_Click(object sender, EventArgs e) + { + if (listRemove.Items.Count == 0) + { + MessageBox.Show("No apps in Recycle bin found."); + return; + } + + SaveFileDialog s = new SaveFileDialog(); + s.FileName = "my-bloatware-list"; + s.Filter = "Text File | *.txt"; + + if (s.ShowDialog() == DialogResult.OK) + { + StreamWriter writer = new StreamWriter(s.OpenFile()); + for (int i = 0; i < listRemove.Items.Count; i++) + { + writer.WriteLine(listRemove.Items[i].ToString()); + } + + writer.Dispose(); + writer.Close(); + } + } + + private void btnHMenu_Click(object sender, EventArgs e) + => this.contextAppMenu.Show(Cursor.Position.X, Cursor.Position.Y); + + private void lblAppsBinOptions_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + => menuAppsImport.PerformClick(); + + private void menuAppsRemoveAll_Click(object sender, EventArgs e) + { + if (MessageBox.Show("This will remove all pre-installed apps for the logged in user, except the Microsoft Store. Do you wish to continue?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes) + { + using (PowerShell script = PowerShell.Create()) + { + this.Enabled = false; + script.AddScript("Get-appxprovisionedpackage –online | where-object {$_.packagename –notlike “*store*”} | Remove-AppxProvisionedPackage –online"); + script.AddScript("Get-AppxPackage | where-object {$_.name –notlike “*store*”} | Remove-AppxPackage"); + + try + { + script.Invoke(); + this.Enabled = true; + RefreshApps(); + } + catch (Exception ex) + { MessageBox.Show(ex.Message); } + } + } + } + + private void menuSyncCommunity_Click(object sender, EventArgs e) + { + if (MessageBox.Show("This will add all the annoying bloatware apps, " + + "pre-installed on Windows 11 including some apps your PC manufacturer included to the removal list." + + "\r\n\nMost of these apps are garbage, but if you find important stuff on the list just remove it " + + "from the right box before hitting \"Uninstall\".", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + { + var apps = BloatwareList.GetList(); + listRemove.Visible = true; + + foreach (string app in apps) + { + listRemove.Items.Add(app); + } + + InitializeApps(); + RefreshApps(); + } + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Views/AppsPageView.resx b/src/BloatyNosy/Views/AppsPageView.resx new file mode 100644 index 0000000..936580f --- /dev/null +++ b/src/BloatyNosy/Views/AppsPageView.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 17, 17 + + \ No newline at end of file diff --git a/src/BloatyNosy/Views/IModsPageView.Designer.cs b/src/BloatyNosy/Views/IModsPageView.Designer.cs new file mode 100644 index 0000000..a17972d --- /dev/null +++ b/src/BloatyNosy/Views/IModsPageView.Designer.cs @@ -0,0 +1,188 @@ +namespace BloatyNosy +{ + partial class IModsPageView + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.btnBack = new System.Windows.Forms.Button(); + this.lnkNoModsSig = new System.Windows.Forms.LinkLabel(); + this.lblHeader = new System.Windows.Forms.Label(); + this.listView = new System.Windows.Forms.ListView(); + this.btnInstall = new System.Windows.Forms.Button(); + this.progress = new System.Windows.Forms.ProgressBar(); + this.label1 = new System.Windows.Forms.Label(); + this.lnkGetModsOnline = new System.Windows.Forms.LinkLabel(); + this.SuspendLayout(); + // + // btnBack + // + this.btnBack.FlatAppearance.BorderSize = 0; + this.btnBack.FlatAppearance.MouseOverBackColor = System.Drawing.Color.WhiteSmoke; + this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnBack.Font = new System.Drawing.Font("Segoe Fluent Icons", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnBack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btnBack.Location = new System.Drawing.Point(0, 0); + this.btnBack.Name = "btnBack"; + this.btnBack.Size = new System.Drawing.Size(42, 38); + this.btnBack.TabIndex = 180; + this.btnBack.Text = "..."; + this.btnBack.UseVisualStyleBackColor = true; + this.btnBack.Click += new System.EventHandler(this.btnBack_Click); + // + // lnkNoModsSig + // + this.lnkNoModsSig.ActiveLinkColor = System.Drawing.Color.DeepPink; + this.lnkNoModsSig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lnkNoModsSig.AutoSize = true; + this.lnkNoModsSig.Font = new System.Drawing.Font("Segoe UI Variable Text", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lnkNoModsSig.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lnkNoModsSig.LinkColor = System.Drawing.Color.DeepPink; + this.lnkNoModsSig.Location = new System.Drawing.Point(119, 459); + this.lnkNoModsSig.Name = "lnkNoModsSig"; + this.lnkNoModsSig.Size = new System.Drawing.Size(229, 17); + this.lnkNoModsSig.TabIndex = 201; + this.lnkNoModsSig.TabStop = true; + this.lnkNoModsSig.Text = "Install and update Mods signature file"; + this.lnkNoModsSig.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkInstallMods_LinkClicked); + // + // lblHeader + // + this.lblHeader.AutoEllipsis = true; + this.lblHeader.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblHeader.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.lblHeader.Location = new System.Drawing.Point(87, 4); + this.lblHeader.Name = "lblHeader"; + this.lblHeader.Size = new System.Drawing.Size(251, 26); + this.lblHeader.TabIndex = 205; + this.lblHeader.Text = "WinModder Marketplace"; + // + // listView + // + this.listView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listView.BackColor = System.Drawing.SystemColors.Control; + this.listView.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listView.CheckBoxes = true; + this.listView.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listView.FullRowSelect = true; + this.listView.HideSelection = false; + this.listView.Location = new System.Drawing.Point(92, 85); + this.listView.Name = "listView"; + this.listView.OwnerDraw = true; + this.listView.Size = new System.Drawing.Size(802, 326); + this.listView.TabIndex = 206; + this.listView.UseCompatibleStateImageBehavior = false; + this.listView.View = System.Windows.Forms.View.Details; + this.listView.DrawColumnHeader += new System.Windows.Forms.DrawListViewColumnHeaderEventHandler(this.listView_DrawColumnHeader); + this.listView.DrawItem += new System.Windows.Forms.DrawListViewItemEventHandler(this.listView_DrawItem); + // + // btnInstall + // + this.btnInstall.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnInstall.BackColor = System.Drawing.Color.MediumVioletRed; + this.btnInstall.FlatAppearance.BorderColor = System.Drawing.Color.Orchid; + this.btnInstall.FlatAppearance.BorderSize = 0; + this.btnInstall.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnInstall.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnInstall.ForeColor = System.Drawing.Color.White; + this.btnInstall.Location = new System.Drawing.Point(689, 38); + this.btnInstall.Name = "btnInstall"; + this.btnInstall.Size = new System.Drawing.Size(181, 30); + this.btnInstall.TabIndex = 207; + this.btnInstall.Text = "Download and install Mods"; + this.btnInstall.UseVisualStyleBackColor = false; + this.btnInstall.Click += new System.EventHandler(this.btnInstall_Click); + // + // progress + // + this.progress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.progress.Location = new System.Drawing.Point(92, 74); + this.progress.Name = "progress"; + this.progress.Size = new System.Drawing.Size(802, 5); + this.progress.TabIndex = 208; + this.progress.Visible = false; + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(110, 426); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(90, 17); + this.label1.TabIndex = 209; + this.label1.Text = "More options"; + // + // lnkGetModsOnline + // + this.lnkGetModsOnline.ActiveLinkColor = System.Drawing.Color.DeepPink; + this.lnkGetModsOnline.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lnkGetModsOnline.AutoSize = true; + this.lnkGetModsOnline.Font = new System.Drawing.Font("Segoe UI Variable Text", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lnkGetModsOnline.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lnkGetModsOnline.LinkColor = System.Drawing.Color.DeepPink; + this.lnkGetModsOnline.Location = new System.Drawing.Point(119, 490); + this.lnkGetModsOnline.Name = "lnkGetModsOnline"; + this.lnkGetModsOnline.Size = new System.Drawing.Size(105, 17); + this.lnkGetModsOnline.TabIndex = 210; + this.lnkGetModsOnline.TabStop = true; + this.lnkGetModsOnline.Text = "Get Mods online"; + this.lnkGetModsOnline.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkGetModsOnline_LinkClicked); + // + // IModsPageView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.AutoScroll = true; + this.Controls.Add(this.lnkGetModsOnline); + this.Controls.Add(this.label1); + this.Controls.Add(this.progress); + this.Controls.Add(this.btnInstall); + this.Controls.Add(this.listView); + this.Controls.Add(this.lblHeader); + this.Controls.Add(this.lnkNoModsSig); + this.Controls.Add(this.btnBack); + this.Name = "IModsPageView"; + this.Size = new System.Drawing.Size(972, 556); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Button btnBack; + private System.Windows.Forms.LinkLabel lnkNoModsSig; + private System.Windows.Forms.Label lblHeader; + private System.Windows.Forms.ListView listView; + private System.Windows.Forms.Button btnInstall; + private System.Windows.Forms.ProgressBar progress; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.LinkLabel lnkGetModsOnline; + } +} diff --git a/src/BloatyNosy/Views/IModsPageView.cs b/src/BloatyNosy/Views/IModsPageView.cs new file mode 100644 index 0000000..b182b83 --- /dev/null +++ b/src/BloatyNosy/Views/IModsPageView.cs @@ -0,0 +1,205 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Windows.Forms; +using System.Xml.Linq; + +namespace BloatyNosy +{ + public partial class IModsPageView : UserControl + { + private ModsPageView modsForm = null; + + public IModsPageView(Control ctr) + { + modsForm = ctr as ModsPageView; + + InitializeComponent(); + InitializeModsSignature(); + + SetStyle(); + } + + private void SetStyle() + { + listView.BackColor = Color.FromArgb(245, 241, 249); + btnBack.Text = "\uE72B"; + } + + private void InitializeModsSignature() + { + // Add required columns + listView.Columns.Add("Name"); + listView.Columns.Add("Description"); + listView.Columns.Add("Developer"); + listView.Columns.Add("Link"); + + try + { + XDocument doc = XDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "modsApp2.xml"); + + foreach (var dm in doc.Descendants("Mod")) + { + ListViewItem item = new ListViewItem(new string[] + { + dm.Element("id").Value, + dm.Element("description").Value, + dm.Element("dev").Value, + dm.Element("uri").Value, + }); + + listView.Items.Add(item); + + listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); + listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); + } + + isFeatureInstalled(); + } + catch + { + MessageBox.Show("Mods signature file not found.\nPlease re-download and install the signatures."); + listView.Visible = false; + lnkNoModsSig.Visible = true; + } + } + + public void isFeatureInstalled() + { + foreach (ListViewItem item in listView.Items) + { + var feature = item.SubItems[3].Text; + if (File.Exists(HelperTool.Utils.Data.DataRootDir + feature.Split('/').Last()) + || File.Exists(HelperTool.Utils.Data.ModsRootDir + feature.Split('/').Last()) + || File.Exists(AppDomain.CurrentDomain.BaseDirectory + feature.Split('/').Last())) + item.ForeColor = Color.Gray; + else + { + item.ForeColor = Color.Black; + } + } + } + + private void btnBack_Click(object sender, EventArgs e) + => modsForm.SetView(new ModsPageView()); + + private async void lnkInstallMods_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + try + { + HelperTool.Utils.CreateModsDir(); + using (WebClient client = new WebClient()) + { + progress.Visible = true; + progress.Value = 0; + client.Credentials = CredentialCache.DefaultNetworkCredentials; + client.DownloadProgressChanged += Wc_DownloadProgressChanged; + Uri uri = new Uri("https://raw.githubusercontent.com/builtbybel/BloatyNosy/main/mods/modsApp2.xml"); + string filename = System.IO.Path.GetFileName(uri.LocalPath); + + await client.DownloadFileTaskAsync(uri, AppDomain.CurrentDomain.BaseDirectory + filename); + + progress.Visible = false; + + MessageBox.Show("We will restart the app to complete the installation.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); + Application.Restart(); + Environment.Exit(0); + } + } + catch (Exception ex) + { MessageBox.Show(ex.Message); } + } + + private async void btnInstall_Click(object sender, EventArgs e) + { + bool bNeedRestart = false; + + if (listView.CheckedItems.Count == 0) + { + MessageBox.Show("No feature selected.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + StringBuilder builder = new StringBuilder(); + + foreach (ListViewItem eachItem in listView.CheckedItems) + { + List list = new List(eachItem.SubItems[3].Text.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)); + + foreach (string url in list) + { + progress.Visible = true; + using (WebClient client = new WebClient()) + { + progress.Value = 0; + client.Credentials = CredentialCache.DefaultNetworkCredentials; + client.DownloadProgressChanged += Wc_DownloadProgressChanged; + Uri uri = new Uri(url); + string filename = System.IO.Path.GetFileName(uri.LocalPath); + string fileExt = System.IO.Path.GetExtension(eachItem.SubItems[3].Text); + + try + { + if (fileExt == ".ps1") + await client.DownloadFileTaskAsync(uri, HelperTool.Utils.Data.ModsRootDir + filename); + else + await client.DownloadFileTaskAsync(uri, AppDomain.CurrentDomain.BaseDirectory + filename + + ); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, listView.FocusedItem.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + builder.Append("\n- " + eachItem.SubItems[0].Text); + + // Restart required by filetypes + if (eachItem.SubItems[3].Text.Contains(".xml")) + // || eachItem.SubItems[3].Text.Contains(".xml")) + { + builder.Append(" (Restart required.)"); + bNeedRestart = true; + } + } + + MessageBox.Show("Mods successfully installed:\n" + builder.ToString(), "", MessageBoxButtons.OK, MessageBoxIcon.Information); + isFeatureInstalled(); + + if (bNeedRestart) + { + MessageBox.Show("We will restart the app to complete the installation of some features."); + Application.Restart(); + Environment.Exit(0); + } + + progress.Visible = false; + } + + private void Wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) + { + progress.Value = e.ProgressPercentage; + progress.Update(); + // this.Invoke((MethodInvoker)(() => lblStatus.Text = $"{e.ProgressPercentage}%")); + } + + private void listView_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e) + { + e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(245, 241, 249)), e.Bounds); + e.DrawText(); + } + + private void listView_DrawItem(object sender, DrawListViewItemEventArgs e) + => e.DrawDefault = true; + + + private void lnkGetModsOnline_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + => HelperTool.Utils.LaunchUri("https://www.builtbybel.com/blog/about-debloos"); + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Views/IModsPageView.resx b/src/BloatyNosy/Views/IModsPageView.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/src/BloatyNosy/Views/IModsPageView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/BloatyNosy/Views/ModsPageView.Designer.cs b/src/BloatyNosy/Views/ModsPageView.Designer.cs new file mode 100644 index 0000000..77fa654 --- /dev/null +++ b/src/BloatyNosy/Views/ModsPageView.Designer.cs @@ -0,0 +1,406 @@ +namespace BloatyNosy +{ + partial class ModsPageView + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ModsPageView)); + this.contextAppMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.menuModEdit = new System.Windows.Forms.ToolStripMenuItem(); + this.pnlForm = new System.Windows.Forms.Panel(); + this.pnlMain = new System.Windows.Forms.Panel(); + this.lblStatus = new System.Windows.Forms.Label(); + this.lblHeader = new System.Windows.Forms.Label(); + this.btnHMenu = new System.Windows.Forms.Button(); + this.btnBack = new System.Windows.Forms.Button(); + this.lnkExploreMods = new System.Windows.Forms.LinkLabel(); + this.lblNoMods = new System.Windows.Forms.Label(); + this.tabD = new System.Windows.Forms.TabControl(); + this.tabDescription = new System.Windows.Forms.TabPage(); + this.rtbDesc = new System.Windows.Forms.RichTextBox(); + this.tabCode = new System.Windows.Forms.TabPage(); + this.rtbCode = new System.Windows.Forms.RichTextBox(); + this.textSearch = new System.Windows.Forms.TextBox(); + this.lnkCode = new System.Windows.Forms.LinkLabel(); + this.lnkDesc = new System.Windows.Forms.LinkLabel(); + this.progress = new System.Windows.Forms.ProgressBar(); + this.btnApply = new System.Windows.Forms.Button(); + this.listMods = new System.Windows.Forms.CheckedListBox(); + this.btnCancel = new System.Windows.Forms.Button(); + this.contextAppMenu.SuspendLayout(); + this.pnlForm.SuspendLayout(); + this.pnlMain.SuspendLayout(); + this.tabD.SuspendLayout(); + this.tabDescription.SuspendLayout(); + this.tabCode.SuspendLayout(); + this.SuspendLayout(); + // + // contextAppMenu + // + this.contextAppMenu.BackColor = System.Drawing.Color.WhiteSmoke; + this.contextAppMenu.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.contextAppMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuModEdit}); + this.contextAppMenu.Name = "menuMain"; + this.contextAppMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.contextAppMenu.Size = new System.Drawing.Size(122, 26); + this.contextAppMenu.Text = "Info"; + // + // menuModEdit + // + this.menuModEdit.Name = "menuModEdit"; + this.menuModEdit.Size = new System.Drawing.Size(121, 22); + this.menuModEdit.Text = "Edit Mod"; + this.menuModEdit.Click += new System.EventHandler(this.menuModEdit_Click); + // + // pnlForm + // + this.pnlForm.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pnlForm.AutoSize = true; + this.pnlForm.Controls.Add(this.pnlMain); + this.pnlForm.Location = new System.Drawing.Point(0, 0); + this.pnlForm.Name = "pnlForm"; + this.pnlForm.Size = new System.Drawing.Size(1054, 795); + this.pnlForm.TabIndex = 193; + // + // pnlMain + // + this.pnlMain.AutoScroll = true; + this.pnlMain.Controls.Add(this.lblStatus); + this.pnlMain.Controls.Add(this.lblHeader); + this.pnlMain.Controls.Add(this.btnHMenu); + this.pnlMain.Controls.Add(this.btnBack); + this.pnlMain.Controls.Add(this.lnkExploreMods); + this.pnlMain.Controls.Add(this.lblNoMods); + this.pnlMain.Controls.Add(this.tabD); + this.pnlMain.Controls.Add(this.textSearch); + this.pnlMain.Controls.Add(this.lnkCode); + this.pnlMain.Controls.Add(this.lnkDesc); + this.pnlMain.Controls.Add(this.progress); + this.pnlMain.Controls.Add(this.btnApply); + this.pnlMain.Controls.Add(this.listMods); + this.pnlMain.Controls.Add(this.btnCancel); + this.pnlMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlMain.Location = new System.Drawing.Point(0, 0); + this.pnlMain.Name = "pnlMain"; + this.pnlMain.Size = new System.Drawing.Size(1054, 795); + this.pnlMain.TabIndex = 197; + // + // lblStatus + // + this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblStatus.AutoEllipsis = true; + this.lblStatus.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblStatus.ForeColor = System.Drawing.Color.DeepPink; + this.lblStatus.Location = new System.Drawing.Point(92, 94); + this.lblStatus.Name = "lblStatus"; + this.lblStatus.Size = new System.Drawing.Size(802, 23); + this.lblStatus.TabIndex = 205; + // + // lblHeader + // + this.lblHeader.AutoEllipsis = true; + this.lblHeader.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblHeader.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.lblHeader.Location = new System.Drawing.Point(87, 4); + this.lblHeader.Name = "lblHeader"; + this.lblHeader.Size = new System.Drawing.Size(114, 26); + this.lblHeader.TabIndex = 204; + this.lblHeader.Text = "WinModder"; + // + // btnHMenu + // + this.btnHMenu.FlatAppearance.BorderSize = 0; + this.btnHMenu.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gainsboro; + this.btnHMenu.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnHMenu.Font = new System.Drawing.Font("Segoe Fluent Icons", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnHMenu.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btnHMenu.Location = new System.Drawing.Point(35, 0); + this.btnHMenu.Name = "btnHMenu"; + this.btnHMenu.Size = new System.Drawing.Size(42, 38); + this.btnHMenu.TabIndex = 203; + this.btnHMenu.Text = "..."; + this.btnHMenu.UseVisualStyleBackColor = true; + this.btnHMenu.Click += new System.EventHandler(this.btnHMenu_Click); + // + // btnBack + // + this.btnBack.FlatAppearance.BorderSize = 0; + this.btnBack.FlatAppearance.MouseOverBackColor = System.Drawing.Color.WhiteSmoke; + this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnBack.Font = new System.Drawing.Font("Segoe Fluent Icons", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnBack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btnBack.Location = new System.Drawing.Point(0, 0); + this.btnBack.Name = "btnBack"; + this.btnBack.Size = new System.Drawing.Size(42, 38); + this.btnBack.TabIndex = 202; + this.btnBack.Text = "..."; + this.btnBack.UseVisualStyleBackColor = true; + this.btnBack.Click += new System.EventHandler(this.btnBack_Click); + // + // lnkExploreMods + // + this.lnkExploreMods.ActiveLinkColor = System.Drawing.Color.DeepPink; + this.lnkExploreMods.AutoSize = true; + this.lnkExploreMods.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lnkExploreMods.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lnkExploreMods.LinkColor = System.Drawing.Color.HotPink; + this.lnkExploreMods.Location = new System.Drawing.Point(229, 4); + this.lnkExploreMods.Name = "lnkExploreMods"; + this.lnkExploreMods.Size = new System.Drawing.Size(129, 26); + this.lnkExploreMods.TabIndex = 201; + this.lnkExploreMods.TabStop = true; + this.lnkExploreMods.Text = "Explore Mods"; + this.lnkExploreMods.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkExploreMods_LinkClicked); + // + // lblNoMods + // + this.lblNoMods.AutoEllipsis = true; + this.lblNoMods.AutoSize = true; + this.lblNoMods.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblNoMods.ForeColor = System.Drawing.Color.Thistle; + this.lblNoMods.Location = new System.Drawing.Point(386, 4); + this.lblNoMods.Name = "lblNoMods"; + this.lblNoMods.Size = new System.Drawing.Size(168, 26); + this.lblNoMods.TabIndex = 200; + this.lblNoMods.Text = "No Mods installed"; + this.lblNoMods.Visible = false; + // + // tabD + // + this.tabD.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabD.Controls.Add(this.tabDescription); + this.tabD.Controls.Add(this.tabCode); + this.tabD.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tabD.Location = new System.Drawing.Point(92, 562); + this.tabD.Name = "tabD"; + this.tabD.SelectedIndex = 0; + this.tabD.Size = new System.Drawing.Size(857, 171); + this.tabD.TabIndex = 194; + // + // tabDescription + // + this.tabDescription.BackColor = System.Drawing.SystemColors.Control; + this.tabDescription.Controls.Add(this.rtbDesc); + this.tabDescription.Location = new System.Drawing.Point(4, 24); + this.tabDescription.Name = "tabDescription"; + this.tabDescription.Padding = new System.Windows.Forms.Padding(3); + this.tabDescription.Size = new System.Drawing.Size(849, 143); + this.tabDescription.TabIndex = 0; + this.tabDescription.Text = "Description"; + // + // rtbDesc + // + this.rtbDesc.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.rtbDesc.BackColor = System.Drawing.SystemColors.Control; + this.rtbDesc.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.rtbDesc.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtbDesc.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.rtbDesc.Location = new System.Drawing.Point(17, 17); + this.rtbDesc.Name = "rtbDesc"; + this.rtbDesc.ReadOnly = true; + this.rtbDesc.Size = new System.Drawing.Size(819, 120); + this.rtbDesc.TabIndex = 11; + this.rtbDesc.Text = resources.GetString("rtbDesc.Text"); + this.rtbDesc.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.rtbDesc_LinkClicked); + // + // tabCode + // + this.tabCode.BackColor = System.Drawing.SystemColors.Control; + this.tabCode.Controls.Add(this.rtbCode); + this.tabCode.Location = new System.Drawing.Point(4, 24); + this.tabCode.Name = "tabCode"; + this.tabCode.Padding = new System.Windows.Forms.Padding(3); + this.tabCode.Size = new System.Drawing.Size(849, 143); + this.tabCode.TabIndex = 1; + this.tabCode.Text = "Code"; + // + // rtbCode + // + this.rtbCode.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.rtbCode.BackColor = System.Drawing.SystemColors.Control; + this.rtbCode.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.rtbCode.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtbCode.ForeColor = System.Drawing.Color.Gray; + this.rtbCode.Location = new System.Drawing.Point(17, 17); + this.rtbCode.Name = "rtbCode"; + this.rtbCode.ReadOnly = true; + this.rtbCode.Size = new System.Drawing.Size(771, 120); + this.rtbCode.TabIndex = 12; + this.rtbCode.Text = "#Follow this project on GitHub.\nStart-Process https://github.com/builtbybel/Deblo" + + "os\n"; + // + // textSearch + // + this.textSearch.BackColor = System.Drawing.Color.WhiteSmoke; + this.textSearch.Font = new System.Drawing.Font("Segoe UI Variable Text", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textSearch.ForeColor = System.Drawing.Color.Gray; + this.textSearch.Location = new System.Drawing.Point(485, 60); + this.textSearch.Name = "textSearch"; + this.textSearch.Size = new System.Drawing.Size(122, 23); + this.textSearch.TabIndex = 199; + this.textSearch.Text = "Search..."; + this.textSearch.Click += new System.EventHandler(this.textSearch_Click); + this.textSearch.TextChanged += new System.EventHandler(this.textSearch_TextChanged); + // + // lnkCode + // + this.lnkCode.ActiveLinkColor = System.Drawing.Color.DeepPink; + this.lnkCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lnkCode.AutoSize = true; + this.lnkCode.Font = new System.Drawing.Font("Segoe UI Variable Display Semil", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lnkCode.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lnkCode.LinkColor = System.Drawing.Color.HotPink; + this.lnkCode.Location = new System.Drawing.Point(172, 531); + this.lnkCode.Name = "lnkCode"; + this.lnkCode.Size = new System.Drawing.Size(38, 17); + this.lnkCode.TabIndex = 198; + this.lnkCode.TabStop = true; + this.lnkCode.Text = "Code"; + this.lnkCode.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkCode_LinkClicked); + // + // lnkDesc + // + this.lnkDesc.ActiveLinkColor = System.Drawing.Color.DeepPink; + this.lnkDesc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lnkDesc.AutoSize = true; + this.lnkDesc.Font = new System.Drawing.Font("Segoe UI Variable Display Semil", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lnkDesc.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lnkDesc.LinkColor = System.Drawing.Color.HotPink; + this.lnkDesc.Location = new System.Drawing.Point(91, 531); + this.lnkDesc.Name = "lnkDesc"; + this.lnkDesc.Size = new System.Drawing.Size(71, 17); + this.lnkDesc.TabIndex = 197; + this.lnkDesc.TabStop = true; + this.lnkDesc.Text = "Description"; + this.lnkDesc.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkDesc_LinkClicked); + // + // progress + // + this.progress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.progress.Location = new System.Drawing.Point(92, 120); + this.progress.Name = "progress"; + this.progress.Size = new System.Drawing.Size(857, 5); + this.progress.TabIndex = 196; + this.progress.Visible = false; + // + // btnApply + // + this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnApply.Font = new System.Drawing.Font("Segoe UI Variable Text", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnApply.ForeColor = System.Drawing.Color.Black; + this.btnApply.Location = new System.Drawing.Point(96, 752); + this.btnApply.Name = "btnApply"; + this.btnApply.Size = new System.Drawing.Size(75, 23); + this.btnApply.TabIndex = 5; + this.btnApply.Text = "Apply"; + this.btnApply.UseVisualStyleBackColor = true; + this.btnApply.Click += new System.EventHandler(this.btnApply_Click); + // + // listMods + // + this.listMods.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listMods.BackColor = System.Drawing.SystemColors.Control; + this.listMods.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listMods.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listMods.FormattingEnabled = true; + this.listMods.Location = new System.Drawing.Point(92, 140); + this.listMods.Name = "listMods"; + this.listMods.Size = new System.Drawing.Size(857, 342); + this.listMods.TabIndex = 195; + this.listMods.SelectedIndexChanged += new System.EventHandler(this.listMods_SelectedIndexChanged); + // + // btnCancel + // + this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnCancel.Font = new System.Drawing.Font("Segoe UI Variable Text", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnCancel.ForeColor = System.Drawing.Color.Black; + this.btnCancel.Location = new System.Drawing.Point(870, 752); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 7; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Visible = false; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // ModsPageView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pnlForm); + this.Name = "ModsPageView"; + this.Size = new System.Drawing.Size(1054, 795); + this.contextAppMenu.ResumeLayout(false); + this.pnlForm.ResumeLayout(false); + this.pnlMain.ResumeLayout(false); + this.pnlMain.PerformLayout(); + this.tabD.ResumeLayout(false); + this.tabDescription.ResumeLayout(false); + this.tabCode.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.ContextMenuStrip contextAppMenu; + private System.Windows.Forms.ToolStripMenuItem menuModEdit; + private System.Windows.Forms.Panel pnlForm; + private System.Windows.Forms.TabControl tabD; + private System.Windows.Forms.TabPage tabDescription; + private System.Windows.Forms.RichTextBox rtbDesc; + private System.Windows.Forms.TabPage tabCode; + private System.Windows.Forms.RichTextBox rtbCode; + private System.Windows.Forms.Panel pnlMain; + private System.Windows.Forms.Label lblNoMods; + private System.Windows.Forms.TextBox textSearch; + private System.Windows.Forms.LinkLabel lnkCode; + private System.Windows.Forms.LinkLabel lnkDesc; + private System.Windows.Forms.ProgressBar progress; + private System.Windows.Forms.Button btnApply; + private System.Windows.Forms.CheckedListBox listMods; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Label lblHeader; + private System.Windows.Forms.Button btnHMenu; + private System.Windows.Forms.Button btnBack; + private System.Windows.Forms.Label lblStatus; + public System.Windows.Forms.LinkLabel lnkExploreMods; + } +} diff --git a/src/BloatyNosy/Views/ModsPageView.cs b/src/BloatyNosy/Views/ModsPageView.cs new file mode 100644 index 0000000..b9edcf2 --- /dev/null +++ b/src/BloatyNosy/Views/ModsPageView.cs @@ -0,0 +1,253 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace BloatyNosy +{ + public partial class ModsPageView : UserControl + { + private ModsManifest _Modsmanifest = new ModsManifest(); + private List ModsList = new List(); + + public Control INavPage; + + public ModsPageView() + { + InitializeComponent(); + + InitializeMods(); + listMods.Items.AddRange(ModsList.ToArray()); + + SetStyle(); + } + + // Some UI nicety + private void SetStyle() + { + HideTabsOnTabControl(tabD); + + BackColor = + listMods.BackColor = + tabD.BackColor = + tabDescription.BackColor = + tabCode.BackColor = + rtbDesc.BackColor = + rtbCode.BackColor = + Color.FromArgb(245, 241, 249); + + btnHMenu.Text = "\uE700"; + btnBack.Text = "\uE72B"; + + INavPage = pnlForm.Controls[0]; // Set default NavPage + } + + public void SetView(Control View) + { + var control = View as Control; + + control.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom); + control.Dock = DockStyle.Fill; + INavPage.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom); + INavPage.Dock = DockStyle.Fill; + + pnlForm.Controls.Clear(); + pnlForm.Controls.Add(View); + } + + private void HideTabsOnTabControl(TabControl tabControl) + { + tabControl.Appearance = TabAppearance.FlatButtons; + tabControl.ItemSize = new Size(0, 1); + tabControl.SizeMode = TabSizeMode.Fixed; + } + + private void InitializeMods() + { + listMods.Items.Clear(); + + try + { + string[] manifests = Directory.GetFiles(HelperTool.Utils.Data.ModsRootDir, "*.ini"); + foreach (string manifest in manifests) + { + ModsList.Add(Path.GetFileNameWithoutExtension(manifest)); + } + } + catch { lblNoMods.Visible = true; btnApply.Visible = false; btnCancel.Visible = false; } + } + + private async void DoMods(string language) + { + var scriptPath = HelperTool.Utils.Data.ModsRootDir + _Modsmanifest.ConditionScript; + // Check e.g. -noexit switch to prevent the PowerShell Console window from closing + var scriptParam = _Modsmanifest.ini.ReadString("Info", "ScriptParam", ""); + + lblStatus.Text = $"Processing \"{scriptPath}\""; + + btnApply.Enabled = false; + btnCancel.Visible = true; + progress.Visible = true; + progress.Style = ProgressBarStyle.Marquee; + progress.MarqueeAnimationSpeed = 30; + + try + { + switch (language) + { + case "PowerShell": + + var startInfo = new ProcessStartInfo() + { + FileName = "powershell.exe", + Arguments = $"-executionpolicy bypass {scriptParam} -file \"{scriptPath}\"", + UseShellExecute = false, + CreateNoWindow = Convert.ToBoolean(_Modsmanifest.ini.ReadString("Info", "CreateNoWindow", "")) + }; + + await Task.Run(() => + { + Process.Start(startInfo).WaitForExit(); + }); + + break; + + case "Command-line": + var process = Process.Start(new ProcessStartInfo("cmd", "/C " + scriptPath) + { + RedirectStandardOutput = true, + WorkingDirectory = HelperTool.Utils.Data.ModsRootDir, + UseShellExecute = false, + CreateNoWindow = Convert.ToBoolean(_Modsmanifest.ini.ReadString("Info", "CreateNoWindow", "")) + }); + + await Task.Run(() => + { + process.WaitForExit(); + }); + + break; + } + lblStatus.Text = ""; + progress.Visible = false; + btnCancel.Visible = false; + btnApply.Enabled = true; + MessageBox.Show("Mod has been successfully applied.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (NullReferenceException ex) + { + string title = "This did not work..."; + string logger = "Exception in \"" + language + "\"\n\n" + ex + "\n\nPlease report this issue to Builtbybel........"; + MessageBox.Show(this, logger, title, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void btnApply_Click(object sender, EventArgs e) + => DoMods(_Modsmanifest.ScriptLanguage); + + private void btnCancel_Click(object sender, EventArgs e) + { + String CurrentUser = Environment.UserName; + Process[] allProcesses = Process.GetProcessesByName("powershell"); + if (null != allProcesses) + { + Process process = new Process(); + ProcessStartInfo startInfo = new ProcessStartInfo(); + startInfo.WindowStyle = ProcessWindowStyle.Hidden; + startInfo.FileName = "cmd.exe"; + startInfo.Arguments = "/C TASKKILL /F /FI \"USERNAME eq " + CurrentUser + "\" /IM powershell.exe"; + process.StartInfo = startInfo; + process.Start(); + process.WaitForExit(); + } + + btnCancel.Visible = false; + } + + private void menuModEdit_Click(object sender, EventArgs e) + { + try + { + string scriptPath = HelperTool.Utils.Data.ModsRootDir + _Modsmanifest.ConditionScript; + + Process process = new Process(); + process.StartInfo.FileName = "powershell_ise.exe"; + process.StartInfo.Arguments = scriptPath; + process.Start(); + } + catch { MessageBox.Show("No Mod selected."); } + } + + private void listMods_SelectedIndexChanged(object sender, EventArgs e) + { + string scriptManifestFile = HelperTool.Utils.Data.ModsRootDir + listMods.Text + ".ini"; + _Modsmanifest.ini = new ModsParser(scriptManifestFile); + string scriptPath = HelperTool.Utils.Data.ModsRootDir + _Modsmanifest.ConditionScript; + + try + { + // Catch description + // Script name + //listMods.Items.Add(_Modsmanifest.DisplayName); + // Script description/publisher + rtbDesc.Text = _Modsmanifest.AboutScript.Replace("\\n", "\r\n") + + Environment.NewLine + Environment.NewLine + "Author of this Mod: " + _Modsmanifest.Publisher; + + // Catch Code + using (StreamReader sr = new StreamReader(scriptPath, Encoding.Default)) + { + StringBuilder content = new StringBuilder(); + + while (!sr.EndOfStream) + content.AppendLine(sr.ReadLine()); + + rtbCode.Text = string.Join(Environment.NewLine, File.ReadAllLines(scriptPath)); + } + } + catch { } + } + + private void textSearch_TextChanged(object sender, EventArgs e) + { + listMods.Items.Clear(); + + foreach (string str in ModsList) + { + if (str.IndexOf(textSearch.Text, 0, StringComparison.CurrentCultureIgnoreCase) != -1) + { + listMods.Items.Add(str); + } + } + } + + private void textSearch_Click(object sender, EventArgs e) + => textSearch.Text = ""; + + private void rtbDesc_LinkClicked(object sender, LinkClickedEventArgs e) + => HelperTool.Utils.LaunchUri(e.LinkText); + + private void lnkExploreMods_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + => this.SetView(new IModsPageView(this)); + + private void lnkDesc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + => tabD.SelectedIndex = 0; + + private void lnkCode_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + => tabD.SelectedIndex = 1; + + private void btnHMenu_Click(object sender, EventArgs e) + => this.contextAppMenu.Show(Cursor.Position.X, Cursor.Position.Y); + + private void btnBack_Click(object sender, EventArgs e) + { + var mainForm = Application.OpenForms.OfType().Single(); + mainForm.pnlForm.Controls.Clear(); + if (mainForm.INavPage != null) mainForm.pnlForm.Controls.Add(mainForm.INavPage); + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Views/ModsPageView.resx b/src/BloatyNosy/Views/ModsPageView.resx new file mode 100644 index 0000000..f83acd8 --- /dev/null +++ b/src/BloatyNosy/Views/ModsPageView.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + You will find here mod files for BloatyNosy WinModder. +- Install mod files directly via the "Explore Mods" link +- Explore mod files and packages online https://www.builtbybel.com/blog/about-bloatynosy + + + + \ No newline at end of file diff --git a/src/BloatyNosy/Views/PackagesPageView.Designer.cs b/src/BloatyNosy/Views/PackagesPageView.Designer.cs new file mode 100644 index 0000000..2b8b907 --- /dev/null +++ b/src/BloatyNosy/Views/PackagesPageView.Designer.cs @@ -0,0 +1,272 @@ +namespace BloatyNosy +{ + partial class PackagesPageView + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.listRemote = new System.Windows.Forms.ListBox(); + this.btnRemoveAll = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.listLocal = new System.Windows.Forms.ListBox(); + this.richStatus = new System.Windows.Forms.RichTextBox(); + this.btnInstall = new System.Windows.Forms.Button(); + this.btnRemove = new System.Windows.Forms.Button(); + this.btnAddAll = new System.Windows.Forms.Button(); + this.btnAdd = new System.Windows.Forms.Button(); + this.btnBack = new System.Windows.Forms.Button(); + this.lblHeader = new System.Windows.Forms.Label(); + this.textSearch = new System.Windows.Forms.TextBox(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.groupBox2.Controls.Add(this.listRemote); + this.groupBox2.Font = new System.Drawing.Font("Segoe UI Variable Text", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBox2.ForeColor = System.Drawing.Color.Violet; + this.groupBox2.Location = new System.Drawing.Point(28, 82); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(411, 648); + this.groupBox2.TabIndex = 49; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Available packages"; + // + // listRemote + // + this.listRemote.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.listRemote.BackColor = System.Drawing.Color.White; + this.listRemote.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listRemote.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listRemote.FormattingEnabled = true; + this.listRemote.ItemHeight = 17; + this.listRemote.Location = new System.Drawing.Point(11, 36); + this.listRemote.Name = "listRemote"; + this.listRemote.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; + this.listRemote.Size = new System.Drawing.Size(394, 595); + this.listRemote.Sorted = true; + this.listRemote.TabIndex = 13; + // + // btnRemoveAll + // + this.btnRemoveAll.Font = new System.Drawing.Font("Segoe UI Variable Text", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnRemoveAll.ForeColor = System.Drawing.Color.Black; + this.btnRemoveAll.Location = new System.Drawing.Point(482, 313); + this.btnRemoveAll.Name = "btnRemoveAll"; + this.btnRemoveAll.Size = new System.Drawing.Size(89, 23); + this.btnRemoveAll.TabIndex = 45; + this.btnRemoveAll.Text = "<< Remove all"; + this.btnRemoveAll.UseVisualStyleBackColor = true; + this.btnRemoveAll.Click += new System.EventHandler(this.btnRemoveAll_Click); + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.listLocal); + this.groupBox1.Controls.Add(this.richStatus); + this.groupBox1.Font = new System.Drawing.Font("Segoe UI Variable Text", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBox1.ForeColor = System.Drawing.Color.DeepPink; + this.groupBox1.Location = new System.Drawing.Point(609, 82); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(411, 648); + this.groupBox1.TabIndex = 50; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Install packages"; + // + // listLocal + // + this.listLocal.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listLocal.BackColor = System.Drawing.Color.White; + this.listLocal.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listLocal.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listLocal.FormattingEnabled = true; + this.listLocal.ItemHeight = 17; + this.listLocal.Location = new System.Drawing.Point(11, 36); + this.listLocal.Name = "listLocal"; + this.listLocal.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; + this.listLocal.Size = new System.Drawing.Size(394, 595); + this.listLocal.Sorted = true; + this.listLocal.TabIndex = 13; + // + // richStatus + // + this.richStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.richStatus.BackColor = System.Drawing.Color.White; + this.richStatus.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.richStatus.Font = new System.Drawing.Font("Segoe UI Variable Text", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.richStatus.ForeColor = System.Drawing.Color.Black; + this.richStatus.HideSelection = false; + this.richStatus.Location = new System.Drawing.Point(11, 19); + this.richStatus.Name = "richStatus"; + this.richStatus.ReadOnly = true; + this.richStatus.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; + this.richStatus.Size = new System.Drawing.Size(393, 613); + this.richStatus.TabIndex = 140; + this.richStatus.Text = ""; + this.richStatus.Visible = false; + // + // btnInstall + // + this.btnInstall.BackColor = System.Drawing.Color.MediumVioletRed; + this.btnInstall.FlatAppearance.BorderColor = System.Drawing.Color.Orchid; + this.btnInstall.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnInstall.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnInstall.ForeColor = System.Drawing.Color.White; + this.btnInstall.Location = new System.Drawing.Point(797, 49); + this.btnInstall.Name = "btnInstall"; + this.btnInstall.Size = new System.Drawing.Size(181, 30); + this.btnInstall.TabIndex = 51; + this.btnInstall.Text = "Download and install packages"; + this.btnInstall.UseVisualStyleBackColor = false; + this.btnInstall.Click += new System.EventHandler(this.btnInstall_Click); + // + // btnRemove + // + this.btnRemove.Font = new System.Drawing.Font("Segoe UI Variable Text", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnRemove.ForeColor = System.Drawing.Color.Black; + this.btnRemove.Location = new System.Drawing.Point(482, 342); + this.btnRemove.Name = "btnRemove"; + this.btnRemove.Size = new System.Drawing.Size(89, 23); + this.btnRemove.TabIndex = 43; + this.btnRemove.Text = "< Remove"; + this.btnRemove.UseVisualStyleBackColor = true; + this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click); + // + // btnAddAll + // + this.btnAddAll.Font = new System.Drawing.Font("Segoe UI Variable Text", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnAddAll.ForeColor = System.Drawing.Color.Black; + this.btnAddAll.Location = new System.Drawing.Point(482, 201); + this.btnAddAll.Name = "btnAddAll"; + this.btnAddAll.Size = new System.Drawing.Size(89, 23); + this.btnAddAll.TabIndex = 46; + this.btnAddAll.Text = "Add all >>"; + this.btnAddAll.Click += new System.EventHandler(this.btnAddAll_Click); + // + // btnAdd + // + this.btnAdd.Font = new System.Drawing.Font("Segoe UI Variable Text", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnAdd.ForeColor = System.Drawing.Color.Black; + this.btnAdd.Location = new System.Drawing.Point(482, 230); + this.btnAdd.Name = "btnAdd"; + this.btnAdd.Size = new System.Drawing.Size(89, 23); + this.btnAdd.TabIndex = 42; + this.btnAdd.Text = "Add >"; + this.btnAdd.UseVisualStyleBackColor = true; + this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); + // + // btnBack + // + this.btnBack.FlatAppearance.BorderSize = 0; + this.btnBack.FlatAppearance.MouseOverBackColor = System.Drawing.Color.WhiteSmoke; + this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnBack.Font = new System.Drawing.Font("Segoe Fluent Icons", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnBack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btnBack.Location = new System.Drawing.Point(0, 0); + this.btnBack.Name = "btnBack"; + this.btnBack.Size = new System.Drawing.Size(42, 38); + this.btnBack.TabIndex = 177; + this.btnBack.Text = "..."; + this.btnBack.UseVisualStyleBackColor = true; + this.btnBack.Click += new System.EventHandler(this.btnBack_Click); + // + // lblHeader + // + this.lblHeader.AutoEllipsis = true; + this.lblHeader.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblHeader.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.lblHeader.Location = new System.Drawing.Point(60, 4); + this.lblHeader.Name = "lblHeader"; + this.lblHeader.Size = new System.Drawing.Size(954, 32); + this.lblHeader.TabIndex = 178; + this.lblHeader.Text = "InstaPackage"; + // + // textSearch + // + this.textSearch.BackColor = System.Drawing.Color.WhiteSmoke; + this.textSearch.Font = new System.Drawing.Font("Segoe UI Variable Text", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textSearch.ForeColor = System.Drawing.Color.Gray; + this.textSearch.Location = new System.Drawing.Point(469, 29); + this.textSearch.Name = "textSearch"; + this.textSearch.Size = new System.Drawing.Size(122, 23); + this.textSearch.TabIndex = 180; + this.textSearch.Text = "Search..."; + this.textSearch.Click += new System.EventHandler(this.textSearch_Click); + this.textSearch.TextChanged += new System.EventHandler(this.textSearch_TextChanged); + // + // PackagesPageView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.AutoScroll = true; + this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.textSearch); + this.Controls.Add(this.lblHeader); + this.Controls.Add(this.btnBack); + this.Controls.Add(this.btnRemoveAll); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.btnInstall); + this.Controls.Add(this.btnRemove); + this.Controls.Add(this.btnAddAll); + this.Controls.Add(this.btnAdd); + this.Controls.Add(this.groupBox2); + this.Name = "PackagesPageView"; + this.Size = new System.Drawing.Size(1054, 795); + this.groupBox2.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.ListBox listRemote; + private System.Windows.Forms.Button btnRemoveAll; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.ListBox listLocal; + private System.Windows.Forms.Button btnInstall; + private System.Windows.Forms.Button btnRemove; + private System.Windows.Forms.Button btnAddAll; + private System.Windows.Forms.Button btnAdd; + public System.Windows.Forms.RichTextBox richStatus; + private System.Windows.Forms.Button btnBack; + private System.Windows.Forms.Label lblHeader; + private System.Windows.Forms.TextBox textSearch; + } +} diff --git a/src/BloatyNosy/Views/PackagesPageView.cs b/src/BloatyNosy/Views/PackagesPageView.cs new file mode 100644 index 0000000..9a34db9 --- /dev/null +++ b/src/BloatyNosy/Views/PackagesPageView.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace BloatyNosy +{ + public partial class PackagesPageView : UserControl + { + private List Packages = new List(); + private List remoteApps = new List(); + + public PackagesPageView() + { + InitializeComponent(); + + RequestPackagesRemote(); + listRemote.Items.AddRange(remoteApps.ToArray()); + + SetStyle(); + } + + // Some UI nicety + private void SetStyle() + { + BackColor = + listRemote.BackColor = + listLocal.BackColor = + richStatus.BackColor = + Color.FromArgb(245, 241, 249); + btnBack.Text = "\uE72B"; + } + + public void RequestPackagesRemote() + { + try + { + var webRequest = WebRequest.Create(@"https://raw.githubusercontent.com/builtbybel/BloatyNosy/main/assets/packages.git"); + string app; + + using (var response = webRequest.GetResponse()) + using (var content = response.GetResponseStream()) + using (var sr = new StreamReader(content)) + { + while ((app = sr.ReadLine()) != null) + { + { + if (!app.StartsWith("#") && (!string.IsNullOrEmpty(app))) + { + remoteApps.Add(app); + } + } + } + } + } + catch (Exception ex) + { MessageBox.Show(ex.Message); } + } + + + private void textSearch_TextChanged(object sender, EventArgs e) + { + listRemote.Items.Clear(); + + foreach (string str in remoteApps) + { + if (str.IndexOf(textSearch.Text, 0, StringComparison.CurrentCultureIgnoreCase) != -1) + { + listRemote.Items.Add(str); + } + } + } + + private void btnAddAll_Click(object sender, EventArgs e) + { + foreach (var item in listRemote.Items) + { + listLocal.Items.Add(item); + } + listRemote.Items.Clear(); + RefreshPackages(); + } + + private void btnAdd_Click(object sender, EventArgs e) + { + if (listRemote.Items.Count != 0) + { + if (listRemote.SelectedItem == null) listRemote.SelectedIndex = 0; + while (listRemote.SelectedItem != null) + { + listLocal.Items.Add(listRemote.SelectedItem); + listRemote.Items.Remove(listRemote.SelectedItem); + } + RefreshPackages(); + } + } + + private void btnRemove_Click(object sender, EventArgs e) + { + if (listLocal.Items.Count != 0) + { + if (listLocal.SelectedItem == null) listLocal.SelectedIndex = 0; + while (listLocal.SelectedItem != null) + { + listRemote.Items.Add(listLocal.SelectedItem); + listLocal.Items.Remove(listLocal.SelectedItem); + } + RefreshPackages(); + } + } + + private void btnRemoveAll_Click(object sender, EventArgs e) + { + foreach (var item in listLocal.Items) + { + listRemote.Items.Add(item); + } + listLocal.Items.Clear(); + RefreshPackages(); + } + + public void WingetInstallPackage(string packageid) + { + var proc = new Process + { + StartInfo = new ProcessStartInfo + { + FileName = HelperTool.Utils.Paths.ShellPS, + Arguments = "winget install --id " + packageid + " --accept-source-agreements --accept-package-agreements", + UseShellExecute = false, + CreateNoWindow = true, + } + }; + + proc.Start(); + proc.WaitForExit(); + } + + private void RefreshPackages() + { + if (listLocal.Items.Count == 0) + { + richStatus.Visible = true; + listLocal.Visible = false; + } + else + { + listLocal.Visible = true; + richStatus.Visible = false; + } + } + + private async void btnInstall_Click(object sender, EventArgs e) + { + richStatus.Visible = true; + listLocal.Visible = false; + btnInstall.Enabled = false; + + StringBuilder message = new StringBuilder(); + + foreach (string p in listLocal.Items) + { + Packages.Add(p); + } + + foreach (string p in Packages) + { + richStatus.Text += Environment.NewLine + "Installing -" + p; + await Task.Run(() => WingetInstallPackage(p)); + } + + groupBox1.Text = "The following apps have been installed"; + listLocal.Visible = true; + btnInstall.Enabled = true; + richStatus.Visible = false; + } + + private void btnBack_Click(object sender, EventArgs e) + { + var mainForm = Application.OpenForms.OfType().Single(); + mainForm.pnlForm.Controls.Clear(); + if (mainForm.INavPage != null) mainForm.pnlForm.Controls.Add(mainForm.INavPage); + } + + private void textSearch_Click(object sender, EventArgs e) + => textSearch.Text = ""; + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Views/PackagesPageView.resx b/src/BloatyNosy/Views/PackagesPageView.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/src/BloatyNosy/Views/PackagesPageView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/BloatyNosy/Views/SetupPageView.Designer.cs b/src/BloatyNosy/Views/SetupPageView.Designer.cs new file mode 100644 index 0000000..92a43d1 --- /dev/null +++ b/src/BloatyNosy/Views/SetupPageView.Designer.cs @@ -0,0 +1,236 @@ +namespace BloatyNosy +{ + partial class SetupPageView + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.lblHeader = new System.Windows.Forms.Label(); + this.btnBack = new System.Windows.Forms.Button(); + this.btnHome = new System.Windows.Forms.Button(); + this.btnNext = new System.Windows.Forms.Button(); + this.btnPrev = new System.Windows.Forms.Button(); + this.cbTable = new System.Windows.Forms.ComboBox(); + this.pbView = new System.Windows.Forms.PictureBox(); + this.label1 = new System.Windows.Forms.Label(); + this.btnAssist = new System.Windows.Forms.Button(); + this.lnkCustomize = new System.Windows.Forms.LinkLabel(); + this.lnkConfigure = new System.Windows.Forms.LinkLabel(); + ((System.ComponentModel.ISupportInitialize)(this.pbView)).BeginInit(); + this.SuspendLayout(); + // + // lblHeader + // + this.lblHeader.AutoEllipsis = true; + this.lblHeader.AutoSize = true; + this.lblHeader.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblHeader.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.lblHeader.Location = new System.Drawing.Point(60, 4); + this.lblHeader.Name = "lblHeader"; + this.lblHeader.Size = new System.Drawing.Size(144, 26); + this.lblHeader.TabIndex = 180; + this.lblHeader.Text = "Setup Windows"; + // + // btnBack + // + this.btnBack.FlatAppearance.BorderSize = 0; + this.btnBack.FlatAppearance.MouseOverBackColor = System.Drawing.Color.WhiteSmoke; + this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnBack.Font = new System.Drawing.Font("Segoe Fluent Icons", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnBack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btnBack.Location = new System.Drawing.Point(0, 0); + this.btnBack.Name = "btnBack"; + this.btnBack.Size = new System.Drawing.Size(42, 38); + this.btnBack.TabIndex = 179; + this.btnBack.Text = "..."; + this.btnBack.UseVisualStyleBackColor = true; + this.btnBack.Click += new System.EventHandler(this.btnBack_Click); + // + // btnHome + // + this.btnHome.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnHome.FlatAppearance.BorderSize = 0; + this.btnHome.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.btnHome.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnHome.ForeColor = System.Drawing.Color.Black; + this.btnHome.Location = new System.Drawing.Point(669, 728); + this.btnHome.Name = "btnHome"; + this.btnHome.Size = new System.Drawing.Size(89, 29); + this.btnHome.TabIndex = 182; + this.btnHome.Text = "Home"; + this.btnHome.Click += new System.EventHandler(this.btnHome_Click); + // + // btnNext + // + this.btnNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnNext.BackColor = System.Drawing.Color.DeepPink; + this.btnNext.FlatAppearance.BorderSize = 0; + this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.btnNext.Font = new System.Drawing.Font("Segoe UI Variable Text", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnNext.ForeColor = System.Drawing.Color.White; + this.btnNext.Location = new System.Drawing.Point(859, 728); + this.btnNext.Name = "btnNext"; + this.btnNext.Size = new System.Drawing.Size(89, 29); + this.btnNext.TabIndex = 183; + this.btnNext.Text = "Next"; + this.btnNext.UseVisualStyleBackColor = false; + this.btnNext.Click += new System.EventHandler(this.btnNext_Click); + // + // btnPrev + // + this.btnPrev.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnPrev.FlatAppearance.BorderSize = 0; + this.btnPrev.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.btnPrev.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnPrev.ForeColor = System.Drawing.Color.Black; + this.btnPrev.Location = new System.Drawing.Point(764, 728); + this.btnPrev.Name = "btnPrev"; + this.btnPrev.Size = new System.Drawing.Size(89, 29); + this.btnPrev.TabIndex = 184; + this.btnPrev.Text = "Previous"; + this.btnPrev.Click += new System.EventHandler(this.btnPrev_Click); + // + // cbTable + // + this.cbTable.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cbTable.BackColor = System.Drawing.Color.White; + this.cbTable.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbTable.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cbTable.FormattingEnabled = true; + this.cbTable.Location = new System.Drawing.Point(102, 734); + this.cbTable.Name = "cbTable"; + this.cbTable.Size = new System.Drawing.Size(121, 23); + this.cbTable.TabIndex = 185; + this.cbTable.SelectedIndexChanged += new System.EventHandler(this.cbTable_SelectedIndexChanged); + // + // pbView + // + this.pbView.BackColor = System.Drawing.Color.Transparent; + this.pbView.ErrorImage = null; + this.pbView.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.pbView.InitialImage = null; + this.pbView.Location = new System.Drawing.Point(37, 133); + this.pbView.Name = "pbView"; + this.pbView.Size = new System.Drawing.Size(457, 330); + this.pbView.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pbView.TabIndex = 186; + this.pbView.TabStop = false; + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(52, 738); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(44, 15); + this.label1.TabIndex = 189; + this.label1.Text = "Jump to"; + // + // btnAssist + // + this.btnAssist.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.btnAssist.FlatAppearance.BorderColor = System.Drawing.Color.HotPink; + this.btnAssist.FlatAppearance.BorderSize = 8; + this.btnAssist.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnAssist.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnAssist.Location = new System.Drawing.Point(546, 131); + this.btnAssist.Name = "btnAssist"; + this.btnAssist.Size = new System.Drawing.Size(466, 332); + this.btnAssist.TabIndex = 190; + this.btnAssist.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.btnAssist.UseVisualStyleBackColor = true; + // + // lnkCustomize + // + this.lnkCustomize.ActiveLinkColor = System.Drawing.Color.HotPink; + this.lnkCustomize.AutoSize = true; + this.lnkCustomize.Font = new System.Drawing.Font("Segoe UI Variable Text Semibold", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lnkCustomize.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lnkCustomize.LinkColor = System.Drawing.Color.DeepPink; + this.lnkCustomize.Location = new System.Drawing.Point(553, 493); + this.lnkCustomize.Name = "lnkCustomize"; + this.lnkCustomize.Size = new System.Drawing.Size(177, 20); + this.lnkCustomize.TabIndex = 191; + this.lnkCustomize.TabStop = true; + this.lnkCustomize.Text = "Customizations available"; + this.lnkCustomize.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkCustomize_LinkClicked); + // + // lnkConfigure + // + this.lnkConfigure.ActiveLinkColor = System.Drawing.Color.HotPink; + this.lnkConfigure.AutoSize = true; + this.lnkConfigure.Font = new System.Drawing.Font("Segoe UI Variable Text Semiligh", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lnkConfigure.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.lnkConfigure.LinkColor = System.Drawing.Color.DeepPink; + this.lnkConfigure.Location = new System.Drawing.Point(553, 528); + this.lnkConfigure.Name = "lnkConfigure"; + this.lnkConfigure.Size = new System.Drawing.Size(126, 20); + this.lnkConfigure.TabIndex = 192; + this.lnkConfigure.TabStop = true; + this.lnkConfigure.Text = "Configure settings"; + this.lnkConfigure.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkConfigure_LinkClicked); + // + // SetupPageView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.AutoScroll = true; + this.Controls.Add(this.lnkConfigure); + this.Controls.Add(this.lnkCustomize); + this.Controls.Add(this.btnAssist); + this.Controls.Add(this.label1); + this.Controls.Add(this.pbView); + this.Controls.Add(this.cbTable); + this.Controls.Add(this.btnPrev); + this.Controls.Add(this.btnNext); + this.Controls.Add(this.btnHome); + this.Controls.Add(this.lblHeader); + this.Controls.Add(this.btnBack); + this.Name = "SetupPageView"; + this.Size = new System.Drawing.Size(1054, 795); + ((System.ComponentModel.ISupportInitialize)(this.pbView)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lblHeader; + private System.Windows.Forms.Button btnBack; + private System.Windows.Forms.Button btnHome; + private System.Windows.Forms.Button btnNext; + private System.Windows.Forms.Button btnPrev; + private System.Windows.Forms.ComboBox cbTable; + public System.Windows.Forms.PictureBox pbView; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnAssist; + private System.Windows.Forms.LinkLabel lnkCustomize; + private System.Windows.Forms.LinkLabel lnkConfigure; + } +} diff --git a/src/BloatyNosy/Views/SetupPageView.cs b/src/BloatyNosy/Views/SetupPageView.cs new file mode 100644 index 0000000..c1d75fc --- /dev/null +++ b/src/BloatyNosy/Views/SetupPageView.cs @@ -0,0 +1,499 @@ +using BloatyNosy.Setup; +using System; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Windows.Forms; + +namespace BloatyNosy +{ + public partial class SetupPageView : UserControl + { + private PageTitle INavPage = PageTitle.Setup; + private string wallpaperPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString() + @"\Microsoft\Windows\Themes\TranscodedWallpaper"; + private readonly string defaultCustomizerText = "Customizations available"; + + private MainForm mainForm = null; + + public SetupPageView(Form frm) + { + mainForm = frm as MainForm; + InitializeComponent(); + + NavigationView(); + EnumTableOfContents(); + + SetStyle(); + } + + // Some UI nicety + private void SetStyle() + { + BackColor = + Color.FromArgb(245, 241, 249); + btnBack.Text = "\uE72B"; + + btnAssist.FlatAppearance.MouseOverBackColor = btnAssist.BackColor; + btnAssist.BackColorChanged += (s, e) => + { + btnAssist.FlatAppearance.MouseOverBackColor = btnAssist.BackColor; + }; + } + + private void btnHome_Click(object sender, EventArgs e) + { + if (INavPage > PageTitle.Setup) + { + INavPage = 0; + cbTable.SelectedIndex = 0; + } + + NavigationView(); + } + + private void btnPrev_Click(object sender, EventArgs e) + { + if (INavPage > PageTitle.Setup) + { + --INavPage; + cbTable.SelectedItem = INavPage++; + } + + NavigationView(); + } + + private void btnNext_Click(object sender, EventArgs e) + { + if (INavPage == PageTitle.Custom) + { + INavPage = 0; + cbTable.SelectedIndex = 0; + NavigationView(); + } + else + { + INavPage++; + NavigationView(); + + cbTable.SelectedItem = INavPage++; + } + } + + // Enum breadcrumbs to cb + private void EnumTableOfContents() + { + cbTable.DataSource = Enum.GetValues(typeof(PageTitle)); + } + + private void cbTable_SelectedIndexChanged(object sender, EventArgs e) + { + PageTitle index; + Enum.TryParse(cbTable.SelectedValue.ToString(), out index); + + INavPage = index; + NavigationView(); + } + + public void NavigationView() + { + btnPrev.Enabled = INavPage > PageTitle.Setup; + btnHome.Visible = INavPage > PageTitle.Setup; + + switch (INavPage) + { + case PageTitle.Setup: + lnkConfigure.Visible = false; + lnkCustomize.Visible = false; + if (!HelperTool.Utils.IsInet()) + lblHeader.Text = "We cannot connect to the Internet. Some functions of the Windows 11 Setup module are not available."; + else lblHeader.Text = "Hi " + Environment.UserName; + + btnAssist.Text = "Lets make sure everything is set up how you want it." + + "\n\nYou have two options:" + + "\n\n1. Use the and buttons to run a guided tour to Windows 11 and to configure the system step by step." + + "\n\n2. Use the Auto-Analyze feature and Apps provided on the main page to quickly set up Windows 11."; + + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/startpage.png?raw=true"; + + break; + + case PageTitle.NewLook: + lnkConfigure.Visible = true; + lnkCustomize.Visible = true; + lnkCustomize.Text = "Customize Windows 11"; + lblHeader.Text = "A new look"; + btnAssist.Text = "As you already see, Windows 11 features a clean design with rounded corners, pastel shades and a centered Start menu and Taskbar."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-look.png?raw=true"; + + break; + + case PageTitle.StartMenu: + lnkConfigure.Visible = true; + lnkCustomize.Visible = true; + lnkCustomize.Text = defaultCustomizerText; + lblHeader.Text = "New Start Menu"; + btnAssist.Text = "Of all the new Windows 11 features, the new launcher-style floating Start Menu is the most distinctive part of Microsoft’s next-gen desktop OS.\n\n" + + "Unlike the traditional Start Menu, the new Start — as Microsoft is calling it — sits right at the center of the taskbar.\n\n" + + "It has a flyout design with pinned and recommended apps accompanying each other."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-startmenu.png?raw=true"; + + break; + + case PageTitle.Apps: + lnkConfigure.Visible = true; + lnkCustomize.Visible = true; + lnkCustomize.Text = "Remove bloatware"; + lblHeader.Text = "Apps"; + btnAssist.Text = "Apparently Windows 11 is also lighter than Windows 10 as for the preinstalled apps.\n\n" + + "The good thing is that at least some of the Windows 10 apps aren’t installed. However, you will still have installed all the hoard of apps that belong to Microsoft, such as Mail and Calendar, Your Phone, Mixed Reality Portal, Solitaire Collection, Get Help, Paint 3D, XBox Game Bar, etc."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-apps.png?raw=true"; + + break; + + case PageTitle.Privacy: + lnkConfigure.Visible = true; + lnkCustomize.Visible = true; + lnkCustomize.Text = "Fix privacy issues"; + lblHeader.Text = "Privacy"; + btnAssist.Text = "One thing Microsoft didn't discuss is about Windows 11 privacy.\n\n" + + "Since Windows 11 Home will essentially require a Microsoft account for most users, data harvesting is part of the package. \n\n" + + "In Windows 11, you'll be able to continue editing cloud files per its algorithmically populated \"Recommended\" section in the new Start Menu.\n" + + "Your browser history will sync between Edge on PC and Edge on mobile, as it already does. Your Skype and Teams conversations will sync as you'd expect too, and your Windows 11 features will migrate to new PCs if you upgrade."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-privacy.png?raw=true"; + + break; + + case PageTitle.MicrosoftStore: + lnkConfigure.Visible = false; + lnkCustomize.Visible = true; + lnkCustomize.Text = "Install packages"; + lblHeader.Text = "New Microsoft Store"; + btnAssist.Text = "There’s a complete UI overhaul on the app store and some speed improvements.\n\n" + + "The key change is allowing more apps into the store. The Microsoft Store is changing on Windows 11, and eventually Windows 10, to include any traditional desktop apps.\n\n" + + "Microsoft previously restricted developers to its Universal Windows Apps, before then allowing some desktop apps that were packaged to use its store for updates. Now any app can be part of the store, a move that aligns with the Windows Package Manager Microsoft released last year."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-msstore.png?raw=true"; + + break; + + case PageTitle.ActionCenter: + lnkConfigure.Visible = true; + lnkCustomize.Visible = false; + lnkCustomize.Text = defaultCustomizerText; + lblHeader.Text = "Action Center"; + btnAssist.Text = "Another great feature of Windows 11 is the revamped Action Center.\n\n" + + "It follows a design language that we have seen on mobile OSes, and I quite like this mobile - first approach to important system toggles\n\n" + + "You can now simply click on the unified “WiFi, volume and battery” button to open the new Action Center. It packs all the necessary controls, including brightness and volume sliders. You can also add more toggles like before."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-actioncenter.png?raw=true"; + + break; + + case PageTitle.FileExplorer: + lnkConfigure.Visible = true; + lnkCustomize.Visible = true; + lnkCustomize.Text = defaultCustomizerText; + lblHeader.Text = "Modern File Explorer"; + btnAssist.Text = "The new experience of file explorer didn’t come with multiple Tabs options similar to tabs in the Microsoft Edge browser.\n\n" + + "By default, File Explorer is now optimized for tablet users.\n\n" + + "The File Explorer interface is not changing dramatically, but there are several noticeable changes. For example, Microsoft is replacing the Windows 8-era ribbon toolbar with a redesigned top menu called command bar allowing you quick access to commonly used actions like share, delete, rename, etc"; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-fileexplorer.png?raw=true"; + + break; + + case PageTitle.SettingsApp: + lnkConfigure.Visible = false; + lnkCustomize.Visible = true; + lnkCustomize.Text = "Check all settings"; + lblHeader.Text = "Redesigned Settings App"; + btnAssist.Text = "The Settings app has been redesigned with a radically different look and it is now using a new navigation menu on the left, similar to Control Panel.\n\n" + + "It comes with a slightly reorganized layout which enables easier access to all your PC settings.\n\n" + + "We’re also getting new pages to customize the touch keyboard, Windows snapping, multitasking and other advanced features like “Wake on Touch” in the new operating system."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-settingsapp.png?raw=true"; + + break; + + case PageTitle.WindowsUpdates: + lnkConfigure.Visible = true; + lnkCustomize.Visible = false; + lblHeader.Text = "Faster Windows Updates"; + btnAssist.Text = "Yes, you read that right. With Windows 11, you will have a much faster Windows update process, thanks to the background installation mechanism. Microsoft has promised that Windows updates will now be 40% smaller, making the process even more efficient. "; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-windowsupdates.png?raw=true"; + + break; + + case PageTitle.SnapLayouts: + lnkConfigure.Visible = false; + lnkCustomize.Visible = true; + lnkCustomize.Text = "Disable SnapLayouts feature"; + lblHeader.Text = "Snap Layouts"; + btnAssist.Text = "Snap is a productivity feature that helps users arrange applications and other windows logically on-screen.\n\n" + + "In 2019, Microsoft relaunched the PowerToys brand with a new utility called FancyZones that extends the Snap experience to allow for more complex and useful on-screen window layouts. A key part of this utility, incredibly, has been integrated into Windows 11 and is now called Snap Layouts.\n\n" + + "When you're working in a bunch of open windows, Windows 11 will let you arrange them in different layouts on the screen, and will save all of those windows in that arrangement. "; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-snaplayouts.png?raw=true"; + + break; + + case PageTitle.Widgets: + lnkConfigure.Visible = false; + lnkCustomize.Visible = true; + lnkCustomize.Text = "Disable Widgets feature"; + lblHeader.Text = "Widgets"; + btnAssist.Text = "With Windows 11, Microsoft has brought Widgets, where you can find all kinds of information with just a click. It’s similar to Google Assistant’s Snapshot and the “Today View” in Apple’s iOS 15 or macOS Monterey."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-widgets.png?raw=true"; + + break; + + case PageTitle.GestureControls: + lnkConfigure.Visible = true; + lnkCustomize.Visible = false; + lblHeader.Text = "Advanced Gesture Controls"; + btnAssist.Text = "Gestures have long been part of Windows 10, but frankly speaking, they were not very smooth, and the transitions between apps and virtual desktops were awful. With the new Advanced Gesture Controls and mandatory precision touchpad requirement for Windows 11, things might get better.\n\n" + + "Now, you can customize three-finger and four-finger swipes according to your preference."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-gestures.png?raw=true"; + + break; + + case PageTitle.WallpapersNSounds: + lnkConfigure.Visible = true; + lnkCustomize.Visible = false; + lblHeader.Text = "New Wallpapers && Sounds"; + btnAssist.Text = "Along with Windows 11, Microsoft has also brought a series of beautiful wallpapers, sounds, and themes. Wallpapers such as Captured Motion, Flow, Sunrise, Glow are some of the nicest wallpapers you can find on a desktop OS.\n\n" + + "Also, the startup and notification sound is really good.\nPress the Magic Button to listen to the startup sound.\n\n" + + "You will find great new wallpapers for Microsoft products also here https://wallpaperhub.app"; + pbView.Visible = true; + pbView.ImageLocation = wallpaperPath; + + break; + + case PageTitle.LockScreen: + lnkConfigure.Visible = true; + lnkCustomize.Visible = false; + lblHeader.Text = "New Minimal Lock Screen"; + btnAssist.Text = "Windows 11 supports animated lock-screen background on PCs that have accelerometer.\n\n" + + "It applies an acrylic blur in the background, and the new variable Segoe UI font makes things even better. If you don’t want all the links and recommendations on the lock screen, you can disable them from Settings for a clean lock screen."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-lockscreen.png?raw=true"; + + break; + + case PageTitle.TouchKeyboard: + lnkConfigure.Visible = true; + lnkCustomize.Visible = false; + lblHeader.Text = "Touch Keyboard Improvements"; + btnAssist.Text = "Windows 11 comes with a Touch Keyboard feature that remains turned off by default. You can use this touch keyboard on a computer or laptop, which is not a touch screen. It is a handy application if your physical keyboard is totally not working or a few keys are not working.\n\n" + + "Microsoft made it more intuitive to use by drawing inspiration from smartphone keyboards.\n\nEven you can use this Touch Keyboard as a substitute for a mechanical keyboard."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-touchkeyboard.png?raw=true"; + break; + + case PageTitle.AndroidApps: + lnkConfigure.Visible = false; + lnkCustomize.Visible = true; + lnkCustomize.Text = "Install Windows Subsystem for Android"; + lblHeader.Text = "Android Apps Support"; + btnAssist.Text = "Microsoft has released Android apps support in the Beta Channel of Windows 11.\n\n" + + "The experience of installing apps is very simple. Microsoft has partnered with Amazon, so the Microsoft Store will list apps but send you over to Amazon’s Appstore app to get them installed or updated.\n\n" + + "The best part is that you can even sideload APKs on your Windows 11 PC and pin them to the Start menu or taskbar and use all of the windowing and multitasking features of Windows 11 just like a regular desktop app."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-androidapps.png?raw=true"; + + break; + + case PageTitle.Gaming: + lnkConfigure.Visible = true; + lnkCustomize.Visible = true; + lblHeader.Text = "Gaming"; + lnkCustomize.Text = "Improve Gaming"; + btnAssist.Text = "If you're a gamer, Windows 11 was made for you and the following three features will make it great for gaming.\n\n" + + "1. During the Windows 11 unveiling, Microsoft announced support for Auto HDR that would elevate the viewing experience while playing games.\n\n" + + "HDR stands for High Dynamic Range, as opposed to SDR or Standard Dynamic Range. With a higher range of colors, HDR gives more vibrant and realistic colors to your video games and makes the sceneries look even better.\n\n" + + "2. Microsoft also revealed that the DirectStorage API will come to Windows PCs. DirectStorage is an API that allows the GPU to load game data directly from the SSD and skip the CPU processing. With DirectStorage, the GPU processes and decompresses the data itself.\n\n" + + "3. Windows 11 will have an deeper Implementation of the Xbox App. The Xbox app and Game Pass are built-in features, giving Game Pass Ultimate subscribers instant access to a massive catalog of video games along with Xbox Cloud Gaming."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/page-gaming.png?raw=true"; + + break; + + case PageTitle.Finish: + lnkConfigure.Visible = false; + lnkCustomize.Visible = true; + lblHeader.Text = "See you in a bit"; + lnkCustomize.Text = "We have some tips for you!"; + btnAssist.Text = "We're finish setting up your device."; + pbView.Visible = true; + pbView.ImageLocation = "https://github.com/builtbybel/ThisIsWin11/blob/main/assets/pages/endpage.png?raw=true"; + + break; + + case PageTitle.Custom: + lnkConfigure.Visible = false; + lnkCustomize.Visible = true; + lnkCustomize.Text = "Customize Windows 11"; + lblHeader.Text = "Customization marketplace"; + btnAssist.Text = "You will find here code snippets (Mods) to customize Windows 11 according to your wishes."; + pbView.Visible = false; + pbView.ImageLocation = ""; + + break; + } + } + + private void btnBack_Click(object sender, EventArgs e) + { + var mainForm = Application.OpenForms.OfType().Single(); + mainForm.pnlForm.Controls.Clear(); + if (mainForm.INavPage != null) mainForm.pnlForm.Controls.Add(mainForm.INavPage); + } + + private void lnkCustomize_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + switch (INavPage) + { + case PageTitle.Apps: + mainForm.SetView(new AppsPageView()); + break; + + case PageTitle.MicrosoftStore: + mainForm.SetView(new PackagesPageView()); + break; + + case PageTitle.Custom: + mainForm.SetView(new ModsPageView()); + break; + + case PageTitle.Finish: // Open Microsoft Tips app + + bool tipsApp = Directory.Exists(Path.Combine + (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "Packages\\Microsoft.Getstarted_8wekyb3d8bbwe")); + + if (!tipsApp) MessageBox.Show("Microsoft Tips app is not installed on this system :(\nYou can get it on the Microsoft Store.", "We are sorry...", MessageBoxButtons.OK, MessageBoxIcon.Information); + else + { + Process.Start(@"shell:appsfolder\Microsoft.Getstarted_8wekyb3d8bbwe!App"); + } + + break; + + default: + + btnBack.PerformClick(); + break; + } + } + + private void lnkConfigure_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + switch (INavPage) + { + case PageTitle.Setup: + break; + + case PageTitle.NewLook: + Process.Start("ms-settings:personalization-background"); + break; + + case PageTitle.StartMenu: + Process.Start("ms-settings:personalization-start"); + break; + + case PageTitle.Apps: + + Process.Start("ms-settings:appsfeatures-app"); + + break; + + case PageTitle.Privacy: + Process.Start("ms-settings:privacy-general"); + break; + + case PageTitle.MicrosoftStore: + + break; + + case PageTitle.ActionCenter: + Process.Start("ms-settings:notifications"); + break; + + case PageTitle.FileExplorer: + + try + { + Process proc = new Process(); + proc.StartInfo.UseShellExecute = false; + proc.StartInfo.FileName = "rundll32.exe"; + proc.StartInfo.Arguments = "shell32.dll,Options_RunDLL 0"; + proc.Start(); + + break; + } + catch { } + + break; + + case PageTitle.SettingsApp: + + break; + + case PageTitle.WindowsUpdates: + Process.Start("ms-settings:windowsupdate-options"); + break; + + case PageTitle.SnapLayouts: + + break; + + case PageTitle.Widgets: + + break; + + case PageTitle.GestureControls: + Process.Start("ms-settings:mousetouchpad"); + break; + + case PageTitle.WallpapersNSounds: + Process.Start("ms-settings:personalization-background"); + break; + + case PageTitle.LockScreen: + Process.Start("ms-settings:lockscreen"); + + break; + + case PageTitle.TouchKeyboard: + + Process.Start("ms-settings:easeofaccess-keyboard"); + break; + + case PageTitle.AndroidApps: + + break; + + case PageTitle.Gaming: + Process.Start("ms-settings:gaming-gamebar"); + break; + + case PageTitle.Finish: + + break; + + case PageTitle.Custom: + + break; + } + } + } +} \ No newline at end of file diff --git a/src/BloatyNosy/Views/SetupPageView.resx b/src/BloatyNosy/Views/SetupPageView.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/src/BloatyNosy/Views/SetupPageView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file