using System;
using System.Collections.ObjectModel;
using System.Management.Automation;
using System.Threading.Tasks;
using Microsoft.Win32;

namespace OSHelper
{
    internal class OSHelper
    {

public static async Task<string> GetWindowsVersion()
        {
            return await Task.Run(() =>
            {
                try
                {
                    using (PowerShell ps = PowerShell.Create())
                    {
                        ps.AddScript("Get-CimInstance -ClassName Win32_OperatingSystem");
                        var results = ps.Invoke();
                        foreach (var result in results)
                        {
                            if (result == null) continue;
                            string caption = result.Properties["Caption"]?.Value?.ToString();
                            string version = result.Properties["Version"]?.Value?.ToString();
                            string build = result.Properties["BuildNumber"]?.Value?.ToString();
                            string displayVersion = Registry.GetValue(
                                @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion",
                                "DisplayVersion", "")?.ToString();
                            string ubr = Registry.GetValue(
                                @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion",
                                "UBR", 0)?.ToString();
                            bool isInsider = false;
                            string ring = null;
                            using (var insiderKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\UpdateOrchestrator"))
                            {
                                if (insiderKey != null)
                                {
                                    object enabled = insiderKey.GetValue("EnableInsiderBuilds");
                                    if (enabled != null && Convert.ToInt32(enabled) == 1)
                                    {
                                        isInsider = true;
                                        ring = insiderKey.GetValue("Ring")?.ToString();
                                    }
                                }
                            }
                            string osName = caption?.Contains("Windows 11") == true ? "Windows 11" :
                                            caption?.Contains("Windows 10") == true ? "Windows 10" :
                                            caption ?? "Unknown OS";
                            string fullBuild = !string.IsNullOrEmpty(build) && !string.IsNullOrEmpty(ubr)
                                ? $"{build}.{ubr}"
                                : build ?? "unknown";
                            string insiderInfo = isInsider ? $" (Insider: {ring})" : "";
                            return $"{osName} {displayVersion}{insiderInfo} (Build {fullBuild})";
                        }
                    }
                }
                catch (Exception ex)
                {
                    return $"OS info unavailable: {ex.Message}";
                }
                return "OS not supported";
            });
        }

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CFixer.Views
{
    public partial class PluginsView : UserControl
    {
        private List<PluginEntry> plugins = new List<PluginEntry>();        // All plugins from the manifest, so full squad
        private List<PluginEntry> visiblePlugins = new List<PluginEntry>(); // Plugins currently shown in the UI (filtered or not)
        private HashSet<string> installedPlugins = new HashSet<string>();   // Names of plugins already installed on disk

        private const string manifestUrl = "https://raw.githubusercontent.com/builtbybel/CrapFixer/main/plugins/plugins_manifest.txt";

        public class PluginEntry
        {
            public string Name { get; set; }
            public string Description { get; set; }
            public string Url { get; set; }
        }

        public PluginsView()
        {
            InitializeComponent();
        }

        private async void PluginsView_Load(object sender, EventArgs e)
        {
            await LoadPlugins();
        }

        /// <summary>
        /// Loads the currently installed plugins from disk into memory.
        /// </summary>
        private void LoadInstalledPlugins()
        {
            var pluginPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins");
            if (Directory.Exists(pluginPath))
            {
                foreach (var file in Directory.GetFiles(pluginPath))
                {
                    installedPlugins.Add(Path.GetFileName(file));
                }
            }
        }

        /// <summary>
        /// Loads plugins from the remote manifest and displays them.
        /// </summary>
        private async Task LoadPlugins()
        {
            try
            {
                LoadInstalledPlugins(); // Load the plugins already installed on disk, gotta know whats up

                using (var client = new WebClient())
                {
                    // Download the plugin manifest
                    string content = await Task.Run(() => client.DownloadString(manifestUrl));

                    // Parse the manifest into our plugins list — all the available plugins decoded!
                    plugins = ParseManifest(content);

                    // Sync visiblePlugins with the full list to keep UI and data in perfect harmony
                    visiblePlugins = plugins.ToList();

                    // Update the ListBox so it shows all the plugins we're tracking right now
                    UpdateVisiblePlugins();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error loading plugins: " + ex.Message);
            }
        }

        /// <summary>
        /// Parses the remote plugin manifest into a list of PluginEntry objects.
        /// </summary>
        private List<PluginEntry> ParseManifest(string content)
        {
            var result = new List<PluginEntry>();
            var lines = content.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None);
            PluginEntry current = null;
            string currentKey = null;

            foreach (var line in lines)
            {
                var trimmedLine = line.Trim();

                if (trimmedLine.StartsWith("[") && trimmedLine.EndsWith("]"))
                {
                    if (current != null)
                        result.Add(current);

                    var name = trimmedLine.Substring(1, trimmedLine.Length - 2).Trim();
                    current = new PluginEntry { Name = name };
                    currentKey = null;
                }
                else if (!string.IsNullOrWhiteSpace(trimmedLine))
                {
                    if (trimmedLine.Contains("=") && current != null)
                    {
                        var parts = trimmedLine.Split(new[] { '=' }, 2);
                        var key = parts[0].Trim();
                        var value = parts[1].Trim();

                        switch (key)
                        {
                            case "description":
                                current.Description = value;
                                currentKey = "description";
                                break;

                            case "url":
                                current.Url = value;
                                currentKey = "url";
                                break;

                            default:
                                currentKey = null;
                                break;
                        }
                    }
                    else if (currentKey == "description" && current != null)
                    {
                        // This line handles multi-line description values.
                        // If the previous key was "description" and the current line does not contain a new key=value pair,
                        // it is considered a continuation of the description.
                        // We append the new line to the existing description, preserving line breaks with "\n".
                        current.Description += "\n" + trimmedLine;
                    }
                }
            }

            if (current != null)
                result.Add(current);

            return result;
        }

        /// <summary>
        /// Downloads and installs checked plugins.
        /// If force is true, existing files will be overwritten.
        /// </summary>
        private async Task InstallPlugins(bool force = false)
        {
            var checkedItems = listPlugins.CheckedItems.Cast<ListViewItem>().ToList();
            if (checkedItems.Count == 0)
            {
                MessageBox.Show("Please check one or more plugins to download.");
                return;
            }

            string savePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins");
            Directory.CreateDirectory(savePath);

            progressBarDownload.Visible = true;
            progressBarDownload.Value = 0;
            progressBarDownload.Maximum = checkedItems.Count;

            int done = 0;

            using (var client = new WebClient())
            {
                foreach (var item in checkedItems)
                {
                    var plugin = item.Tag as PluginEntry;
                    if (plugin == null)
                        continue;

                    string file = Path.Combine(savePath, Path.GetFileName(plugin.Url));

                    // Skip download if file exists and not forcing overwrite
                    if (!force && File.Exists(file))
                    {
                        progressBarDownload.Value = ++done;
                        continue;
                    }

                    try
                    {
                        await client.DownloadFileTaskAsync(new Uri(plugin.Url), file);
                        installedPlugins.Add(Path.GetFileName(plugin.Url));
                        item.SubItems[1].Text = "Yes";  // Update Installed column
                        //item.Checked = true;                // Ensure checked
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Failed to download {plugin.Name}: {ex.Message}");
                    }

                    progressBarDownload.Value = ++done;
                }
            }

            progressBarDownload.Visible = false;
        }

        private async void btnPluginInstall_Click(object sender, EventArgs e)
        {
            await InstallPlugins(force: false);   // skip installed
        }

        /// <summary>
        /// Updates all plugins by selecting all and force-downloading them.
        /// </summary>
        private async void btnPluginUpdateAll_Click(object sender, EventArgs e)
        {
            // Check all items in the list
            foreach (ListViewItem item in listPlugins.Items)
            {
                item.Checked = true;
            }

            // Force install (overwrite even if already installed)
            await InstallPlugins(force: true);

            // Update the status of all plugins to "Updated"
            foreach (ListViewItem item in listPlugins.Items)
            {
                item.SubItems[1].Text = "Updated";
            }

            MessageBox.Show("All plugins updated.");
        }

        private void btnPluginRemove_Click(object sender, EventArgs e)
        {
            string pluginPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins");

            var checkedItems = listPlugins.CheckedItems.Cast<ListViewItem>().ToList();

            if (checkedItems.Count == 0)
            {
                MessageBox.Show("No plugins selected.");
                return;
            }

            foreach (var item in checkedItems)
            {
                var plugin = item.Tag as PluginEntry;
                if (plugin == null)
                    continue;

                string path = Path.Combine(pluginPath, Path.GetFileName(plugin.Url));

                if (File.Exists(path))
                    File.Delete(path);

                installedPlugins.Remove(Path.GetFileName(plugin.Url));
                item.SubItems[1].Text = "No";
                item.Checked = false;
            }

            MessageBox.Show("Selected plugins removed.");
        }

        private void btnPluginEdit_Click(object sender, EventArgs e)
        {
            if (listPlugins.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select a plugin first.");
                return;
            }

            var plugin = listPlugins.SelectedItems[0].Tag as PluginEntry;
            if (plugin == null) return;

            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins", Path.GetFileName(plugin.Url));

            if (!File.Exists(path))
            {
                MessageBox.Show("Plugin file not found. Please install the plugin first.");
                return;
            }

            try
            {
                var ext = Path.GetExtension(path).ToLower();
                var editor = ext == ".ps1" ? "powershell_ise.exe" : "notepad.exe";
                Process.Start(editor, $"\"{path}\"");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not open plugin: " + ex.Message);
            }
        }

        /// <summary>
        /// Shows plugin information in a MessageBox.
        /// </summary>
        private void btnHelp_Click(object sender, EventArgs e)
        {
            if (listPlugins.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select a plugin first.");
                return;
            }

            var plugin = listPlugins.SelectedItems[0].Tag as PluginEntry;
            if (plugin != null)
            {
                MessageBox.Show(plugin.Description, $"Info: {plugin.Name}");
            }
        }

        private void listPlugins_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listPlugins.SelectedItems.Count == 0)
                return;

            var plugin = listPlugins.SelectedItems[0].Tag as PluginEntry;
            if (plugin != null)
            {
                btnDescription.Text = plugin.Description;
            }
        }

        /// <summary>
        /// Updates the ListView with filtered plugin entries,
        /// including name, install status, and plugin type.
        /// Type is determined by plugin name ("(NX)" means native plugin),
        /// or file extension (.ps1 = Powershell; others = Other).
        /// </summary>
        private void UpdateVisiblePlugins(string query = "")
        {
            visiblePlugins = plugins
                .Where(p =>
                    p.Name.ToLower().Contains(query) ||
                    (p.Description?.ToLower() ?? "").Contains(query))
                .ToList();

            listPlugins.Items.Clear();

            foreach (var plugin in visiblePlugins)
            {
                var fileName = Path.GetFileName(plugin.Url);
                bool isInstalled = installedPlugins.Contains(fileName);

                // Determine plugin type
                string type;
                if (plugin.Name.Trim().EndsWith("(NX)", StringComparison.OrdinalIgnoreCase))
                {
                    type = "NX";
                }
                else if (Path.GetExtension(plugin.Url).Equals(".ps1", StringComparison.OrdinalIgnoreCase))
                {
                    type = "Powershell";
                }
                else
                {
                    type = "Other";
                }

                var item = new ListViewItem(plugin.Name);
                item.SubItems.Add(isInstalled ? "Yes" : "No");
                item.SubItems.Add(type);
                item.Tag = plugin;
                item.Checked = isInstalled;

                listPlugins.Items.Add(item);
            }

            // Auto-resize columns to fit header and content
            foreach (ColumnHeader column in listPlugins.Columns)
            {
                column.Width = -2;
            }
        }

        private void textSearch_TextChanged(object sender, EventArgs e)
        {
            string query = textSearch.Text.Trim().ToLower();
            UpdateVisiblePlugins(query);
        }

        private void textSearch_Click(object sender, EventArgs e)
        {
            textSearch.Text = string.Empty;
        }

        private void btnPluginSubmit_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
            {
                FileName = "https://github.com/builtbybel/CrapFixer/blob/main/plugins/plugins_manifest.txt",
                UseShellExecute = true
            });
        }

        private void linkPluginUsage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://github.com/builtbybel/CrapFixer/blob/main/plugins/DemoPluginPack.ps1");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;

/// <summary>
/// Provides functionality to load, execute, analyze, and fix external PowerShell-based plugins.
/// </summary>
///
public static class PluginManager
{
    /// 1. Execute a PowerShell script asynchronously and log output/errors.
    public static async Task ExecutePlugin(string pluginPath)
    {
        try
        {
            using (var process = new Process())
            {
                process.StartInfo.FileName = "powershell.exe";
                process.StartInfo.Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"{pluginPath}\"";
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.RedirectStandardError = true;
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.CreateNoWindow = true;

                process.OutputDataReceived += (s, e) =>
                {
                    if (!string.IsNullOrEmpty(e.Data))
                        Logger.Log($"[PS Output] {e.Data}");
                };

                process.ErrorDataReceived += (s, e) =>
                {
                    if (!string.IsNullOrEmpty(e.Data))
                        Logger.Log($"[PS Error] {e.Data}", LogLevel.Error);
                };

                process.Start();
                process.BeginOutputReadLine();
                process.BeginErrorReadLine();

                await Task.Run(() => process.WaitForExit());
                Logger.Log($"✅ Script executed: {Path.GetFileName(pluginPath)}");
            }
        }
        catch (Exception ex)
        {
            Logger.Log($"❌ Error executing script: {ex.Message}", LogLevel.Error);
        }
    }

    /// 2. Load all .ps1 plugin files from the 'plugins' folder into a TreeView.
    public static void LoadPlugins(TreeView treeView)
    {
        string pluginsFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins");

        if (!Directory.Exists(pluginsFolder))
        {
            Directory.CreateDirectory(pluginsFolder);
            return;
        }

        var pluginsNode = new TreeNode("Plugins")
        {
            BackColor = Color.Magenta,
            ForeColor = Color.White
        };

        foreach (var scriptPath in Directory.GetFiles(pluginsFolder, "*.ps1"))
        {
            var scriptName = Path.GetFileNameWithoutExtension(scriptPath);
            var scriptNode = new TreeNode
            {
                Text = $"{scriptName}", // [PS]
                ToolTipText = scriptPath,
                Tag = scriptPath,
                Checked = false
            };
            pluginsNode.Nodes.Add(scriptNode);
        }

        treeView.Nodes.Add(pluginsNode);
        treeView.ExpandAll();
    }

    /// 3. Parse the [Commands] section from plugin content.
    private static Dictionary<string, string> ParseCommands(string pluginContent)
    {
        return ParseSection(pluginContent, "Commands");
    }

    /// 4. Parse the [Expect] section from plugin content.
    private static Dictionary<string, string> ParseExpect(string pluginContent)
    {
        return ParseSection(pluginContent, "Expect");
    }

    /// 5. Generic parser for named sections like [Commands] or [Expect].
    /// Lines must be in 'key = value' format.
    private static Dictionary<string, string> ParseSection(string content, string sectionName)
    {
        var result = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
        var lines = content.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

        bool insideSection = false;
        foreach (var line in lines)
        {
            var trimmed = line.Trim();
            if (trimmed.Equals($"[{sectionName}]", StringComparison.OrdinalIgnoreCase))
            {
                insideSection = true;
                continue;
            }
            // Exit the section when another section begins
            if (insideSection)
            {
                if (trimmed.StartsWith("[") && trimmed.EndsWith("]"))
                    break;

                // Parse lines of form: key = value
                var idx = trimmed.IndexOf('=');
                if (idx > 0)
                {
                    var key = trimmed.Substring(0, idx).Trim();
                    var val = trimmed.Substring(idx + 1).Trim();
                    result[key] = val;
                }
            }
        }

        return result;
    }

    /// 6. Execute a shell command (CMD) and return exit code and output.
    private static async Task<(int exitCode, string output)> ExecuteCommand(string command)
    {
        var process = new Process();
        var outputBuilder = new StringBuilder();

        process.StartInfo.FileName = "cmd.exe";
        process.StartInfo.Arguments = $"/c \"{command}\"";
        process.StartInfo.RedirectStandardOutput = true;
        process.StartInfo.RedirectStandardError = true;
        process.StartInfo.UseShellExecute = false;
        process.StartInfo.CreateNoWindow = true;

        process.OutputDataReceived += (s, e) => { if (e.Data != null) outputBuilder.AppendLine(e.Data); };
        process.ErrorDataReceived += (s, e) => { if (e.Data != null) outputBuilder.AppendLine(e.Data); };

        process.Start();
        process.BeginOutputReadLine();
        process.BeginErrorReadLine();

        await Task.Run(() => process.WaitForExit());

        return (process.ExitCode, outputBuilder.ToString());
    }

    /// <summary>
    /// 7. Analyzes a single plugin node by running its 'Check' command
    /// and comparing the output against expected values defined in the [Expect] section.
    /// Logs a summary indicating success if all checks pass, or warnings if mismatches occur.
    /// Only the specified plugin node is analyzed, regardless of its checked state.
    /// </summary>
    /// <param name="node">The TreeNode representing the plugin to analyze, with script path stored in Tag.</param>
    public static async Task AnalyzePlugin(TreeNode node)
    {
        if (node == null || node.Tag == null || !File.Exists(node.Tag.ToString()))
        {
           // Logger.Log($"❌ Script file not found for plugin: {node?.Text}", LogLevel.Error);
            Logger.Log(new string('-', 50), LogLevel.Info);
        }
        else
        {
            string pluginName = node.Text;
            string path = node.Tag.ToString();
            string content = File.ReadAllText(path);

            Dictionary<string, string> commands = ParseCommands(content);
            Dictionary<string, string> expected = ParseExpect(content);

            if (!commands.ContainsKey("Check"))
            {
                Logger.Log($"🔎 Plugin ready: [PS] {Path.GetFileName(path)}");
                Logger.Log(new string('-', 50), LogLevel.Info);
            }
            else
            {
                string checkCmd = commands["Check"];
                var result = await ExecuteCommand(checkCmd);
                string output = result.Item2;

                bool allMatched = true;
                StringBuilder mismatchDetails = new StringBuilder();

                foreach (var entry in expected)
                {
                    string key = entry.Key;
                    string expectedVal = entry.Value;

                    var match = Regex.Match(output, $@"{Regex.Escape(key)}\s+REG_\w+\s+(\S+)", RegexOptions.IgnoreCase);

                    if (match.Success)
                    {
                        string actual = match.Groups[1].Value;

                        if (!expectedVal.Equals(actual, StringComparison.OrdinalIgnoreCase))
                        {
                            allMatched = false;
                            mismatchDetails.AppendLine($"   ➤ {key}: expected '{expectedVal}', found '{actual}'");
                        }
                    }
                    else
                    {
                        allMatched = false;
                        mismatchDetails.AppendLine(
                            $"   ➤ Warning: The registry key '{key}' could not be located in the output. " +
                            "This usually means the key is missing and the tweak will have to add it. " +
                            "[InternalCode: Could not be parsed from output]");
                    }
                }

                if (allMatched)
                {
                    Logger.Log($"✅ Plugin: {pluginName} is properly configured.", LogLevel.Info);
                    node.ForeColor = Color.Gray;
                }
                else
                {
                    Logger.Log($"❌ Plugin: {pluginName} requires attention.\n{mismatchDetails}", LogLevel.Warning);
                    node.ForeColor = Color.Red;
                }

                Logger.Log(new string('-', 50), LogLevel.Info);
            }
        }
    }

    /// <summary>
    /// 8. Applies the fix to a single plugin node.
    /// This method processes only the specified node regardless of its checked state.
    /// It attempts to run the "Do" command from the plugin script, or falls back to executing the entire script.
    /// </summary>
    public static async Task FixPlugin(TreeNode node)
    {
        if (node?.Tag is string path && File.Exists(path))
        {
            var content = File.ReadAllText(path);
            var commands = ParseCommands(content);

            if (commands.TryGetValue("Do", out string doCmd))
            {
                Logger.Log($"🔧 Running Do command for plugin: {node.Text}");
                var (exitCode, output) = await ExecuteCommand(doCmd);
                Logger.Log($"Do Output:\n{output}");

                Logger.Log(exitCode == 0 ? "✅ Fix applied successfully." : "❌ Fix failed.");
            }
            else
            {
                Logger.Log($"🔧 No Do command found, executing full script.");
                await ExecutePlugin(path);
            }
        }
    }

    /// <summary>
    /// 9. Reverts changes for a single plugin node.
    /// </summary>
    public static async Task RestorePlugin(TreeNode node)
    {
        if (node?.Tag is string path && File.Exists(path))
        {
            var content = File.ReadAllText(path);
            var commands = ParseCommands(content);

            if (commands.TryGetValue("Undo", out string undoCmd))
            {
                Logger.Log($"♻ Running Undo command for plugin: {node.Text}");
                var (exitCode, output) = await ExecuteCommand(undoCmd);
                Logger.Log($"Undo Output:\n{output}");

                Logger.Log(exitCode == 0 ? "✅ Restore successful." : "❌ Restore failed.");
            }
            else
            {
                Logger.Log($"⚠ No Undo command found. Restore not possible.");
                MessageBox.Show("Restore is not possible for this plugin.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }

    /// 10. Recursively analyze all checked plugin nodes.
    public static async Task AnalyzeAll(TreeNode node)
    {
        if (node.Checked && node.Tag is string path && File.Exists(path))
            await AnalyzePlugin(node);

        foreach (TreeNode child in node.Nodes)
            await AnalyzeAll(child);
    }

    public static async Task AnalyzeAllPlugins(TreeNodeCollection nodes)
    {
        Logger.Log("\n🔌 PLUGIN ANALYSIS", LogLevel.Info);
        Logger.Log(new string('=', 50), LogLevel.Info);

        foreach (TreeNode node in nodes)
            await AnalyzeAll(node);
    }

    /// 11. Recursively apply fixes for all checked plugin nodes.
    public static async Task FixChecked(TreeNode node)
    {
        if (node.Checked && node.Tag is string pluginPath)
        {
            var pluginName = Path.GetFileName(pluginPath);
            var proceed = ShowPluginWarning(pluginName);
            if (!proceed) return;
            await FixPlugin(node);
        }

        foreach (TreeNode child in node.Nodes)
            await FixChecked(child);
    }

    /// 12. Return true if the node represents a PowerShell plugin file.
    public static bool IsPluginNode(TreeNode node)
    {
        return node?.Tag is string path && path.EndsWith(".ps1", StringComparison.OrdinalIgnoreCase);
    }

    /// 13. Show a warning before executing external plugin code.
    public static bool ShowPluginWarning(string pluginName)
    {
        var result = MessageBox.Show(
            $"⚠ WARNING: The plugin '{pluginName}' is an external script. Its execution is outside this app's responsibility and at your own risk.\n" +
            "Proceed only if you trust the source of this plugin. Do you want to continue?",
            "Plugin Activation Warning",
            MessageBoxButtons.YesNo,
            MessageBoxIcon.Warning
        );

        return result == DialogResult.Yes;
    }

    public static bool ShowHelp(TreeNode node)
    {
        string info = GetPluginHelpInfo(node);
        if (!string.IsNullOrEmpty(info))
        {
            MessageBox.Show(info, $"Plugin Help: {node.Text}", MessageBoxButtons.OK, MessageBoxIcon.Information);
            return true;
        }
        return false;
    }

    /// <summary>
    /// Returns the help/info string from the plugin commands section for the given node.
    /// Assumes node.Tag contains the script path as string.
    /// </summary>
    public static string GetPluginHelpInfo(TreeNode node)
    {
        if (node?.Tag is string path && File.Exists(path))
        {
            string content = File.ReadAllText(path);
            // Simple parsing to find line starting with "Info=" under [Commands]
            bool inCommandsSection = false;
            foreach (var line in content.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
            {
                var trimmed = line.Trim();

                if (trimmed.StartsWith("[Commands]", StringComparison.OrdinalIgnoreCase))
                {
                    inCommandsSection = true;
                    continue;
                }
                if (trimmed.StartsWith("[") && trimmed.EndsWith("]") && inCommandsSection)
                {
                    // Left commands section
                    break;
                }
                if (inCommandsSection && trimmed.StartsWith("Info=", StringComparison.OrdinalIgnoreCase))
                {
                    return trimmed.Substring(5).Trim(); // Return the text after "Info="
                }
            }
        }

        return null; // No info found or invalid node
    }
}

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CFixer
{
    /// <summary>
    /// Handles navigation button highlighting for a set of UI buttons.
    /// </summary>
    public class NavigationHandler
    {
        // List of all buttons managed by the navigation handler
        private readonly List<Button> _buttons;

        // Color used for the background of the active button
        private readonly Color _activeBackgroundColor = Color.FromArgb(180, 150, 200, 240);

        // Color used for the background of inactive buttons (same as form)
        private readonly Color _inactiveBackgroundColor = Color.FromArgb(103, 103, 103);

        // Color used for the border of the active button
        private readonly Color _activeBorderColor = Color.FromArgb(255, 120, 170, 210);

        /// <summary>
        /// Event fired when a navigation button is clicked.
        /// </summary>
        public event Action<Button> NavigationButtonClicked;

        /// <summary>
        /// Initializes the handler with the buttons that should be managed.
        /// </summary>
        /// <param name="buttons">The buttons to include in the navigation group.</param>
        public NavigationHandler(params Button[] buttons)
        {
            _buttons = new List<Button>(buttons);

            foreach (var button in _buttons)
            {
                button.Click += OnButtonClick;
            }
        }

        private void OnButtonClick(object sender, EventArgs e)
        {
            if (sender is Button clickedButton)
            {
                SetActive(clickedButton);
                clickedButton.FindForm().ActiveControl = null;  // Remove focus so no extra border is drawn
                NavigationButtonClicked?.Invoke(clickedButton);
            }
        }

        /// <summary>
        /// Sets the given button as active and updates the appearance of all buttons.
        /// </summary>
        /// <param name="activeButton">The button to mark as active.</param>
        public void SetActive(Button activeButton)
        {
            foreach (var button in _buttons)
            {
                // Skip GitHub button to avoid conflicts with its custom behavior
                if (button.Name.Equals("btnGitHub", StringComparison.OrdinalIgnoreCase))
                    continue;

                bool isActive = button == activeButton;

                if (isActive)
                {
                    button.BackColor = _activeBackgroundColor;
                    button.FlatAppearance.BorderColor = _activeBorderColor;
                    button.FlatAppearance.BorderSize = 1;
                }
                else
                {
                    button.BackColor = _inactiveBackgroundColor;
                    button.FlatAppearance.BorderSize = 0;
                }

                button.ForeColor = Color.WhiteSmoke;
            }
        }

        /// <summary>
        /// Loads and assigns icons to buttons asynchronously based on their names.
        /// </summary>
        /// <param name="iconFolder">The relative folder path where the icon files are located. Defaults to "icons". Each button's icon file name is
        /// derived from the button's name by removing the "btn" prefix, converting the remainder to lowercase, and
        /// appending ".png".</param>
        public async Task LoadNavigationIcons(string iconFolder = "icons")
        {
            string basePath = AppDomain.CurrentDomain.BaseDirectory;
            string fullIconPath = Path.Combine(basePath, iconFolder);
            if (!Directory.Exists(fullIconPath)) return;

            // Create graphics context to get system DPI scaling (default is 96 DPI)
            using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
            {
                float dpiScale = g.DpiX / 96f;
                int defaultIconSize = (int)(32 * dpiScale);     // Scale 32px base size with DPI
                int githubIconSize = (int)(42 * dpiScale);       // Special size for GitHub button

                foreach (var button in _buttons)
                {
                    // Convert button name like "btnHome" > "home.png"
                    string buttonName = button.Name.ToLower();
                    string fileName;

                    if (buttonName == "btngithub")
                        fileName = "github.png";
                    else if (buttonName.StartsWith("btn"))
                        fileName = buttonName.Replace("btn", "") + ".png";
                    else
                        continue;

                    string filePath = Path.Combine(fullIconPath, fileName);

                    if (!File.Exists(filePath))
                        continue;

                    try
                    {
                        // Read file bytes asynchronously off the UI thread
                        byte[] imageData = await Task.Run(() => File.ReadAllBytes(filePath));

                        using (var ms = new MemoryStream(imageData))
                        using (Image original = Image.FromStream(ms))
                        {
                            int iconSize = buttonName == "btngithub" ? githubIconSize : defaultIconSize;

                            Bitmap resized = new Bitmap(iconSize, iconSize);
                            try
                            {
                                using (Graphics gr = Graphics.FromImage(resized))
                                {
                                    gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                                    gr.DrawImage(original, 0, 0, iconSize, iconSize);
                                }

                                // Set button image
                                button.Image = resized;
                                button.ImageAlign = ContentAlignment.TopCenter;
                                button.TextAlign = ContentAlignment.BottomCenter;
                            }
                            catch
                            {
                                resized.Dispose(); // Cleanup if drawing fails
                                throw;
                            }
                        }
                    }
                    catch
                    {
                        // Optional: log or ignore loading errors
                    }
                }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CFixer.Views
{
    public partial class ViveView : UserControl
    {
        private List<ViveFeature> featureList;
        private string viveToolPath;

        public ViveView()
        {
            InitializeComponent();
            IsViveToolAvailable();
            InitFeatureList();
            LoadFeaturesToGrid();

            // Fire and forget async call
            _ = UpdateFeatureStatusFromSystem();
        }

        private void IsViveToolAvailable()
        {
            string pluginsDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins");

            var viveFolder = Directory.GetDirectories(pluginsDir)
                                      .FirstOrDefault(dir => Path.GetFileName(dir).ToLower().StartsWith("vive"));

            if (viveFolder == null)
            {
                viveToolPath = null;
                btnDescription.Text = "Enable experimental and hidden features (Disabled)";
                return;
            }

            string exePath = Path.Combine(viveFolder, "ViVeTool.exe");
            if (File.Exists(exePath))
            {
                viveToolPath = exePath;
                btnDescription.Text = "Enable experimental and hidden features (Enabled)";
            }
        }

        /// <summary>
        /// Initializes hardcoded feature list with names, IDs and default states.
        /// </summary>
        private void InitFeatureList()
        {
            featureList = new List<ViveFeature>
            {
                new ViveFeature
                {
                    Ids = new List<int> {47205210, 49221331, 49381526, 49402389, 49820095, 55495322, 48433719},
                    Name = "Enable the redesigned Windows 11 Start menu",
                    InfoUrl = "https://www.neowin.net/guides/how-to-enable-the-redesigned-windows-11-start-menu/",
                    Enabled = false
                },
                new ViveFeature
                {
                    Ids = new List<int> {52467192,53079680},
                    Name = "Enable Text extractor in Snipping Tool",
                    InfoUrl = "https://blogs.windows.com/windows-insider/2025/04/15/text-extractor-in-snipping-tool-begins-rolling-out-to-windows-insiders/",
                    Enabled = false
                }
                    ,new ViveFeature
                {
                    Ids = new List<int> {45624564},
                    Name = "Enable Drag Tray Share UI",
                    InfoUrl = "https://www.neowin.net/news/windows-11-is-getting-a-quirky-new-way-to-share-files/",
                    Enabled = false
                }
            };
        }

        /// <summary>
        /// Loads the feature list into the DataGridView UI.
        /// </summary>
        private void LoadFeaturesToGrid()
        {
            dataGridView.Rows.Clear();

            foreach (var feature in featureList)
            {
                int rowIndex = dataGridView.Rows.Add();
                var row = dataGridView.Rows[rowIndex];

                row.Cells["EnabledColumn"].Value = feature.Enabled;
                row.Cells["NameColumn"].Value = feature.Name;
                row.Cells["IdColumn"].Value = feature.IdsAsString;
                row.Cells["InfoColumn"].Value = feature.InfoUrl;
                row.Cells["StatusColumn"].Value = "Unknown";
            }
        }

        /// <summary>
        /// Executes ViVeTool with given feature IDs and state.
        /// </summary>
        private void ApplyFeature(List<int> ids, bool enable)
        {
            if (string.IsNullOrEmpty(viveToolPath))
            {
                MessageBox.Show("ViVeTool not found. Please ensure it is installed in the plugins folder.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string action = enable ? "/enable" : "/disable";
            string idArg = string.Join(",", ids);
            string args = $"{action} /id:{idArg}";

            Process.Start(new ProcessStartInfo
            {
                FileName = viveToolPath,
                Arguments = args,
                UseShellExecute = true,
                CreateNoWindow = true,
                Verb = "runas" // Run as administrator
            });
        }

        /// <summary>
        /// Applies the currently selected states from the DataGridView to the system using ViVeTool.
        /// </summary>
        private async void btnViveApply_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < dataGridView.Rows.Count; i++)
            {
                var row = dataGridView.Rows[i];
                if (row.IsNewRow) continue;

                bool isEnabled = Convert.ToBoolean(row.Cells["EnabledColumn"].Value);
                string idText = row.Cells["IdColumn"].Value.ToString();
                List<int> ids = idText.Split(',').Select(s => int.Parse(s.Trim())).ToList();

                ApplyFeature(ids, isEnabled);
            }

            Task.Delay(1000).Wait();
            await UpdateFeatureStatusFromSystem(); // Refresh the status after applying changes

            MessageBox.Show("Features have been applied.", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        /// <summary>
        /// Queries the current system state using ViVeTool and returns a map of ID => isEnabled.
        /// </summary>
        // Pro ID ein Query machen, um den Status exakt zu ermitteln
        private Dictionary<int, bool> QueryCurrentFeatureStates()
        {
            var statusMap = new Dictionary<int, bool>();

            if (string.IsNullOrEmpty(viveToolPath))
            {
                MessageBox.Show("ViVeTool not found. Please ensure it is installed in the plugins folder.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return statusMap;
            }

            var allIds = featureList.SelectMany(f => f.Ids).Distinct();

            foreach (int id in allIds)
            {
                ProcessStartInfo psi = new ProcessStartInfo
                {
                    FileName = viveToolPath,
                    Arguments = $"/query /id:{id}",
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    CreateNoWindow = true
                };

                using (Process proc = Process.Start(psi))
                {
                    string output = proc.StandardOutput.ReadToEnd();
                    proc.WaitForExit();

                    bool enabled = output.Contains("Enabled");
                    statusMap[id] = enabled;
                }
            }

            return statusMap;
        }

        /// <summary>
        /// Asynchronously updates the grid checkboxes and status labels to reflect actual feature states on the system.
        /// </summary>
        private async Task UpdateFeatureStatusFromSystem()
        {
            // Run QueryCurrentFeatureStates on a background thread
            var systemStatus = await Task.Run(() => QueryCurrentFeatureStates());

            // Update UI on the UI thread
            if (dataGridView.InvokeRequired)
            {
                dataGridView.Invoke(new Action(() =>
                {
                    UpdateGridWithStatus(systemStatus);
                }));
            }
            else
            {
                UpdateGridWithStatus(systemStatus);
            }
        }

        /// <summary>
        /// Updates the grid rows with the given status dictionary.
        /// </summary>
        private void UpdateGridWithStatus(Dictionary<int, bool> systemStatus)
        {
            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                if (row.IsNewRow) continue;

                string idText = row.Cells["IdColumn"].Value.ToString();
                var ids = idText.Split(',').Select(s => int.Parse(s.Trim())).ToList();

                int enabledCount = ids.Count(id => systemStatus.ContainsKey(id) && systemStatus[id]);

                string status = "Disabled";
                if (enabledCount == ids.Count)
                    status = "All Enabled";
                else if (enabledCount > 0)
                    status = "Partially Enabled";

                row.Cells["StatusColumn"].Value = status;
            }
        }

        private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dataGridView.Columns["InfoColumn"].Index && e.RowIndex >= 0)
            {
                var url = dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value?.ToString();
                if (!string.IsNullOrEmpty(url))
                {
                    try
                    {
                        Process.Start(new ProcessStartInfo
                        {
                            FileName = url,
                            UseShellExecute = true
                        });
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Failed to open link:\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }

        /// <summary>
        /// Represents a single ViVe feature group.
        /// </summary>
        public class ViveFeature
        {
            public List<int> Ids { get; set; }
            public string Name { get; set; }
            public bool Enabled { get; set; }
            public string InfoUrl { get; set; }

            public string IdsAsString => string.Join(",", Ids);
        }

        private void linkPluginUsage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            MessageBox.Show("This plugin uses ViVeTool to enable hidden Windows features.\n" +
    "Please download ViVeTool (e.g. 'ViVeTool-v0.3.x-IntelAmd') from:\n" +
    "https://github.com/thebookisclosed/ViVe/releases\n" +
    "Extract it and place the contents into a subfolder inside the 'plugins' directory.\n\n");
        }

        private void btnApplyCustom_Click(object sender, EventArgs e)
        {
            string input = txtCustomIds.Text;

            if (string.IsNullOrWhiteSpace(input))
            {
                MessageBox.Show("Please enter one or more feature IDs.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // Parse input (e.g., "123,456,789")
            var idList = new List<int>();
            var parts = input.Split(',');

            foreach (var part in parts)
            {
                if (int.TryParse(part.Trim(), out int id))
                {
                    idList.Add(id);
                }
                else
                {
                    MessageBox.Show($"Invalid ID: '{part}'", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            if (idList.Count == 0)
            {
                MessageBox.Show("No valid IDs found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Ask whether to enable or disable
            var result = MessageBox.Show(
             $"Do you want to ENABLE these features?\n\n{string.Join(", ", idList)}\n\n" +
             "Yes = Enable\nNo = Disable\nCancel = Abort",
             "Confirm Action",
             MessageBoxButtons.YesNoCancel,
             MessageBoxIcon.Question);

            if (result == DialogResult.Cancel) return;

            bool enable = (result == DialogResult.Yes);

            ApplyFeature(idList, enable);

            MessageBox.Show("Custom feature action sent to ViVeTool.", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Windows.Forms;

namespace CFixer.Views
{
    public partial class SettingsView : UserControl
    {
        public SettingsView()
        {
            InitializeComponent();
            LoadSettings();
            CheckIfIconsInstalled();
        }

        /// <summary>
        /// Collects and saves all relevant checkbox settings to the INI file.
        /// </summary>
        public void SaveSettings()
        {
            var settings = new Dictionary<string, bool>
    {
        { nameof(checkSaveToINI), checkSaveToINI.Checked },
    };

            IniStateManager.SaveViewSettings("SETTINGS", settings);
        }

        /// <summary>
        /// Loads checkbox settings from the INI file and applies them to the view.
        /// </summary>
        public void LoadSettings()
        {
            var settings = IniStateManager.LoadViewSettings("SETTINGS");
            checkSaveToINI.Checked = settings.GetValueOrDefault(nameof(checkSaveToINI), false);
        }

        private void SettingsView_Leave(object sender, EventArgs e)
        {
            SaveSettings();
        }

        private void CheckIfIconsInstalled()
        {
            string iconFolder = Path.Combine(Application.StartupPath, "icons");
            string[] requiredIcons = { "fixer.png", "options.png", "restore.png" };

            bool allIconsExist = requiredIcons.All(icon => File.Exists(Path.Combine(iconFolder, icon)));

            checkInstallIcons.Enabled = !allIconsExist;
        }

        private async void checkInstallIcons_CheckedChanged(object sender, EventArgs e)
        {
            var result = MessageBox.Show(
            "By default, buttons have no icons to reduce app size. Enable this to download and display navigation icons." +
            "\nWould you like to install it now?",
                                    "Icons Pack Detected",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Information
                                    );

            if (result == DialogResult.Yes)
            {
                try
                {
                    string iconFolder = Path.Combine(Application.StartupPath, "icons");
                    if (!Directory.Exists(iconFolder))
                        Directory.CreateDirectory(iconFolder);

                    string[] iconFiles = new string[]
                    {
                "fixer.png",
                "options.png",
                "restore.png"
                    };

                    string baseUrl = "https://raw.githubusercontent.com/builtbybel/CrapFixer/main/icons/";

                    using (var wc = new WebClient())
                    {
                        foreach (string fileName in iconFiles)
                        {
                            string url = baseUrl + fileName;
                            string localPath = Path.Combine(iconFolder, fileName);
                            await wc.DownloadFileTaskAsync(new Uri(url), localPath);
                        }
                    }

                    MessageBox.Show(
                        "All icons have been successfully installed in the 'icons' folder!\n\n💖 Love CrapFixer? Consider supporting me with a small donation to keep this tool alive and improving!",
                        "Icons Installed",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information
                    );

                    // Restart the application to apply changes
                    Application.Restart();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("❌ An error occurred while downloading the icons:\n" + ex.Message,
                        "Download Failed",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
            }
        }
    }
}

using Features;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CrapFixer
{
    /// <summary>
    /// Provides operations to load, analyze, fix, restore, and show help for FeatureNodes.
    /// </summary>
    public static class FeatureNodeManager
    {
        private static int totalChecked;
        private static int issuesFound;

        // Public properties to access the analysis results
        public static int TotalChecked => totalChecked;

        public static int IssuesFound => issuesFound;

        public static void ResetAnalysis()
        {
            totalChecked = 0;
            issuesFound = 0;
            Logger.Clear();
        }

        /// <summary>
        /// Loads all features into the TreeView.
        /// </summary>
        public static void LoadFeatures(TreeView tree)
        {
            // Hide the TreeView to avoid flickering and visible scroll jump
            tree.Visible = false;

            var features = FeatureLoader.Load();
            tree.Nodes.Clear();

            foreach (var feature in features)
                AddNode(tree.Nodes, feature);

            // root nodes (categories)
            foreach (TreeNode root in tree.Nodes)
            {
                root.NodeFont = new Font(tree.Font, FontStyle.Bold);
                root.ForeColor = Color.RoyalBlue; // category color
            }

            tree.ExpandAll(); // expand all nodes

            // Set scroll to top and make TreeView visible
            tree.BeginInvoke(new Action(() =>
            {
                // Ensure the first node is shown at the top (prevents auto-scroll to bottom)
                if (tree.Nodes.Count > 0) tree.TopNode = tree.Nodes[0];
                tree.Visible = true;
            }));
        }

        /// <summary>
        /// Recursively adds a FeatureNode and its children into the TreeView.
        /// </summary>
        private static void AddNode(TreeNodeCollection treeNodes, FeatureNode featureNode)
        {
            string text = featureNode.IsCategory
                ? "  " + featureNode.Name + "  " // add extra space to avoid clipping
                : featureNode.Name;

            TreeNode node = new TreeNode(text)
            {
                Tag = featureNode,
                Checked = featureNode.DefaultChecked,
            };
            treeNodes.Add(node);

            foreach (var child in featureNode.Children)
                AddNode(node.Nodes, child);
        }

        /// <summary>
        /// Analyzes all checked features recursively and logs only issues.
        /// </summary>
        public static async Task AnalyzeAll(TreeNodeCollection nodes)
        {
            ResetAnalysis();

            // Iterate through all nodes and analyze each one recursively
            foreach (TreeNode node in nodes)
            {
                // Recursively analyze each node and ensure async tasks are awaited
                await AnalyzeCheckedRecursive(node);
            }

            Logger.Log("🔎 ANALYSIS COMPLETE", LogLevel.Info);
            Logger.Log(new string('=', 50), LogLevel.Info);

            int ok = totalChecked - issuesFound;
            Logger.Log($"Summary: {ok} of {totalChecked} checked settings are OK; {issuesFound} require attention.",
                issuesFound > 0 ? LogLevel.Warning : LogLevel.Info);
        }

        /// <summary>
        /// Recursively checks all features and logs misconfigurations.
        /// </summary>
        private static async Task AnalyzeCheckedRecursive(TreeNode node)
        {
            if (node.Tag is FeatureNode fn)
            {
                // If the node is not a category, is checked, and has a feature to check
                if (!fn.IsCategory && node.Checked && fn.Feature != null)
                {
                    totalChecked++;
                    bool isOk = await fn.Feature.CheckFeature();  // Await the async operation

                    if (!isOk)
                    {
                        issuesFound++;
                        node.ForeColor = Color.Red; // Mark as misconfigured
                        string category = node.Parent?.Text ?? "General";
                        Logger.Log($"❌ [{category}] {fn.Name} - Not configured as recommended.");
                        Logger.Log($"   ➤ {fn.Feature.GetFeatureDetails()}");
                        // Log a separator when an issue was found
                        Logger.Log(new string('-', 50), LogLevel.Info);
                    }
                    else
                    {
                        node.ForeColor = Color.Gray; // Mark as properly configured
                    }
                }

                // Recursively process child nodes and ensure awaiting the tasks
                foreach (TreeNode child in node.Nodes)
                {
                    await AnalyzeCheckedRecursive(child);  // Recursively call and await the result
                }
            }
        }

        /// <summary>
        /// Fixes all checked features recursively.
        /// </summary>
        public static async Task FixChecked(TreeNode node)
        {
            if (node.Tag is FeatureNode fn)
            {
                if (!fn.IsCategory && node.Checked && fn.Feature != null)
                {
                    bool result = await fn.Feature.DoFeature();
                    Logger.Log(result
                        ? $"🔧 {fn.Name} - Fixed"
                        : $"❌ {fn.Name} - ⚠ Fix failed (This feature may require admin privileges)",
                        result ? LogLevel.Info : LogLevel.Error);
                }

                foreach (TreeNode child in node.Nodes)
                    await FixChecked(child);
            }
        }

        /// <summary>
        /// Restores all checked features recursively.
        /// </summary>
        public static void RestoreChecked(TreeNode node)
        {
            if (node.Tag is FeatureNode fn)
            {
                if (!fn.IsCategory && node.Checked && fn.Feature != null)
                {
                    bool ok = fn.Feature.UndoFeature();
                    string category = node.Parent?.Text ?? "General";
                    Logger.Log(ok
                        ? $"↩ [{category}] {fn.Name} - Restored"
                        : $"❌ [{category}] {fn.Name} - Restore failed",
                        ok ? LogLevel.Info : LogLevel.Error);
                }

                foreach (TreeNode child in node.Nodes)
                    RestoreChecked(child);
            }
        }
        /// <summary>
        /// Analyzes a selected feature or, if it's a category, analyzes only checked child features.
        /// </summary>
        public static async void AnalyzeFeature(TreeNode node)
        {
            // Analyze this node if it's a leaf node (not a category)
            if (node.Tag is FeatureNode fn && !fn.IsCategory && fn.Feature != null)
            {
                bool isOk = await fn.Feature.CheckFeature();
                node.ForeColor = isOk ? Color.Gray : Color.Red;

                if (isOk)
                {
                    Logger.Log($"✅ Feature: {fn.Name} is properly configured.", LogLevel.Info);
                }
                else
                {
                    string category = node.Parent?.Text ?? "General";
                    Logger.Log($"❌ Feature: {fn.Name} requires attention.", LogLevel.Warning);
                    Logger.Log($"   ➤ {fn.Feature.GetFeatureDetails()}");
                    Logger.Log(new string('-', 50), LogLevel.Info);
                }
            }
            else
            {
                // If it's a category node, analyze only checked child nodes
                foreach (TreeNode child in node.Nodes)
                {
                    if (child.Checked)
                        AnalyzeFeature(child);
                }
            }
        }

        /// <summary>
        /// Attempts to fix the selected feature or, if it is a category, fixes only checked child features.
        /// </summary>
        public static async Task FixFeature(TreeNode node)
        {
            // Try to fix this node if it is NOT a category (i.e., a leaf node)
            if (node.Tag is FeatureNode fn && !fn.IsCategory && fn.Feature != null)
            {
                // Always fix the selected leaf node, regardless of Checked
                bool result = await fn.Feature.DoFeature();
                Logger.Log(result
                    ? $"🔧 {fn.Name} - Fixed"
                    : $"❌ {fn.Name} - ⚠ Fix failed (This feature may require admin privileges)",
                    result ? LogLevel.Info : LogLevel.Error);
            }
            else
            {
                // If it's a category node, fix only checked child nodes (recursively)
                foreach (TreeNode child in node.Nodes)
                {
                    if (child.Checked)
                        await FixFeature(child);
                }
            }
        }

        /// <summary>
        /// Restores a selected feature (always) or, if it's a category, only restores checked child features.
        /// Logs success or failure.
        /// </summary>
        public static void RestoreFeature(TreeNode node)
        {
            // Restore feature node regardless of Checked state
            if (node.Tag is FeatureNode fn && !fn.IsCategory && fn.Feature != null)
            {
                bool ok = fn.Feature.UndoFeature();
                Logger.Log(ok
                    ? $"↩ {fn.Name} - Restored"
                    : $"❌ {fn.Name} - Restore failed",
                    ok ? LogLevel.Info : LogLevel.Error);
            }
            else
            {
                // For category nodes, only restore checked children
                foreach (TreeNode child in node.Nodes)
                {
                    if (child.Checked)
                        RestoreFeature(child);
                }
            }
        }

        /// <summary>
        /// Displays help information for the selected feature or plugin.
        /// If a feature is selected, also offers to search online.
        /// </summary>
        public static void ShowHelp(TreeNode node)
        {
            // Show help for features
            if (node?.Tag is FeatureNode fn && fn.Feature != null)
            {
                string info = fn.Feature.Info();
                MessageBox.Show(
                    !string.IsNullOrEmpty(info) ? info : "No additional information available.",
                    $"Help: {fn.Name}",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);

                // Optional online help
                var result = MessageBox.Show(
                    "Would you like to search online for more information about this feature?",
                    "Online Help",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    string searchQuery = Uri.EscapeDataString(fn.Feature.GetFeatureDetails());
                    string webUrl = $"https://www.google.com/search?q={searchQuery}";
                    System.Diagnostics.Process.Start(new ProcessStartInfo
                    {
                        FileName = webUrl,
                        UseShellExecute = true
                    });
                }

                return;
            }

            // Show help for plugins
            if (!PluginManager.ShowHelp(node))
            {
                MessageBox.Show("⚠ No feature or plugin selected, or help info unavailable.",
                    "Help",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Management.Deployment;

namespace CrapFixer
{
    public class AppAnalysisResult
    {
        public string AppName { get; set; }
        public string FullName { get; set; }
    }

    public class AppManagerService
    {
        private Dictionary<string, string> _appDirectory = new Dictionary<string, string>();

        // Loads all apps and stores them in the directory (name -> fullName)
        private async Task LoadAppsAsync()
        {
            _appDirectory.Clear();

            var pm = new PackageManager();
            var packages = await Task.Run(() =>
                pm.FindPackagesForUserWithPackageTypes(string.Empty, PackageTypes.Main));

            foreach (var p in packages)
            {
                string name = p.Id.Name;
                string fullName = p.Id.FullName;

                if (!_appDirectory.ContainsKey(name))
                {
                    _appDirectory[name] = fullName;
                }
            }
            Logger.Log($"(Checked against {_appDirectory.Count} apps from the system)");
        }

        /// <summary>
        /// Analyzes the installed apps against provided bloatware patterns and whitelist,
        /// logs the results, and returns the matches.
        /// </summary>
        /// <param name="bloatwarePatterns">List of bloatware keywords to check against</param>
        /// <param name="whitelistPatterns">List of app names to ignore</param>
        /// <param name="scanAll">If true, scans all apps regardless of bloatware patterns</param>
        public async Task<List<AppAnalysisResult>> AnalyzeAndLogAppsAsync(
            string[] bloatwarePatterns,
            string[] whitelistPatterns,
            bool scanAll)
        {
            var apps = await AnalyzeAppsAsync(bloatwarePatterns, whitelistPatterns, scanAll);

            if (apps.Count > 0)
            {
                Logger.Log("Bloatware apps detected:", LogLevel.Info);
                foreach (var app in apps)
                {
                    Logger.Log($"❌ [ Bloatware ] {app.AppName} ({app.FullName})", LogLevel.Warning);
                }
            }
            else
            {
                Logger.Log("✅ No Microsoft Store bloatware apps found.", LogLevel.Info);
            }

            Logger.Log(""); // Add a blank line for spacing

            return apps;
        }

        /// <summary>
        /// Analyzes the apps based on predefined apps (from resources) and returns matching apps.
        /// </summary>
        /// <param name="predefinedApps"></param>
        /// <returns></returns>
        public async Task<List<AppAnalysisResult>> AnalyzeAppsAsync(string[] bloatwarePatterns, string[] whitelistPatterns, bool scanAll = false)
        {
            Logger.Log("\n🧩 APPS ANALYSIS", LogLevel.Info);
            Logger.Log(new string('=', 50), LogLevel.Info);

            await LoadAppsAsync(); // Load all installed apps

            var result = new List<AppAnalysisResult>();

            foreach (var app in _appDirectory)
            {
                string appName = app.Key.ToLower();

                // Always skip whitelisted apps
                if (whitelistPatterns.Any(w => appName.Contains(w)))
                    continue;

                if (scanAll)
                {
                    // If wildcard is set, include everything not whitelisted
                    result.Add(new AppAnalysisResult
                    {
                        AppName = app.Key,
                        FullName = app.Value
                    });
                }
                else
                {
                    // Only match against provided patterns
                    foreach (var pattern in bloatwarePatterns)
                    {
                        if (appName.Contains(pattern))
                        {
                            result.Add(new AppAnalysisResult
                            {
                                AppName = app.Key,
                                FullName = app.Value
                            });
                            break;
                        }
                    }
                }
            }

            return result;
        }

        // Uninstall an app by its full name
        public async Task<bool> UninstallApp(string fullName)
        {
            try
            {
                var pm = new PackageManager();
                var operation = pm.RemovePackageAsync(fullName);

                var resetEvent = new ManualResetEvent(false);
                operation.Completed = (o, s) => resetEvent.Set();
                await Task.Run(() => resetEvent.WaitOne());

                if (operation.Status == AsyncStatus.Completed)
                {
                    Logger.Log($"Successfully uninstalled app: {fullName}");
                    return true;
                }
                else
                {
                    Logger.Log($"Failed to uninstall appe: {fullName}", LogLevel.Warning);
                    return false;
                }
            }
            catch (Exception ex)
            {
                Logger.Log($"Error during uninstalling app {fullName}: {ex.Message}", LogLevel.Warning);
                return false;
            }
        }

        /// <summary>
        /// Uninstalls the selected apps and logs the results.
        /// </summary>
        /// <param name="selectedApps"></param>
        /// <returns></returns>
        public async Task<List<string>> UninstallSelectedAppsAsync(List<string> selectedApps)
        {
            List<string> removedApps = new List<string>();

            foreach (var fullName in selectedApps)
            {
                Logger.Log($"🗑 Removing app: {fullName}...");

                // Uninstall the app using its full name
                var success = await UninstallApp(fullName);
                if (success)
                {
                    removedApps.Add(fullName);
                }
            }

            // Log results for apps that were successfully removed
            foreach (var app in removedApps)
            {
                Logger.Log($"🗑 Removed Store App: {app}");
            }

            // Log failed attempts
            var failedApps = selectedApps.Except(removedApps).ToList();
            foreach (var app in failedApps)
            {
                Logger.Log($"⚠ Failed to remove Store App: {app}", LogLevel.Warning);
            }

            Logger.Log("App cleanup complete.");

            return removedApps; // Return removed apps to update the UI
        }

        /// <summary>
        /// Loads external bloatware and whitelist patterns from a text file (e.g., CFEnhancer.txt).
        /// Also checks if wildcard (*) is set to scan all apps.
        /// </summary>
        /// <param name="fileName">Name of the file to load from (must be in Plugins folder)</param>
        /// <returns>
        /// A tuple containing:
        /// - bloatwarePatterns: List of apps to flag as bloatware
        /// - whitelistPatterns: List of apps to ignore/exclude from detection
        /// - scanAll: Whether all apps should be shown regardless of matching patterns
        /// </returns>
        public (string[] bloatwarePatterns, string[] whitelistPatterns, bool scanAll) LoadExternalBloatwarePatterns(string fileName = "CFEnhancer.txt")
        {
            try
            {
                string exeDir = AppDomain.CurrentDomain.BaseDirectory;
                string fullPath = Path.Combine(exeDir, "Plugins", fileName);

                if (!File.Exists(fullPath))
                {
                    Logger.Log($"⚠ The bloatware radar stays basic for now 🧠. Get the enhanced detection list from Options > Plugins > CFEnhancer plugin", LogLevel.Warning);
                    return (Array.Empty<string>(), Array.Empty<string>(), false);
                }

                var lines = File.ReadAllLines(fullPath);
                var bloatware = new List<string>();  // Apps to detect as bloatware
                var whitelist = new List<string>();  // Apps to ignore completely
                bool scanAll = false;               // Set to true if wildcard (*) is present

                foreach (var line in lines)
                {
                    // Strip comments after "#" and trim whitespace
                    var entry = line.Split('#')[0].Trim();

                    // Skip empty lines or lines with only comments
                    if (string.IsNullOrWhiteSpace(entry))
                        continue;

                    // Wildcard entry means: show all installed apps
                    if (entry == "*" || entry == "*.*")
                    {
                        scanAll = true;
                        continue;
                    }

                    // Entries starting with "!" go to the whitelist (excluded apps)
                    if (entry.StartsWith("!"))
                        whitelist.Add(entry.Substring(1).Trim().ToLower());
                    else
                        bloatware.Add(entry.ToLower());  // All other entries are bloatware patterns
                }

                return (bloatware.ToArray(), whitelist.ToArray(), scanAll);
            }
            catch (Exception ex)
            {
                Logger.Log($"Error reading external bloatware file: {ex.Message}", LogLevel.Warning);
                return (Array.Empty<string>(), Array.Empty<string>(), false);
            }
        }

        /// <summary>
        /// OPTIONALLY!Returns all installed apps in the system.
        /// </summary>
        /// <returns></returns>
        public async Task<List<AppAnalysisResult>> GetAllInstalledAppsAsync()
        {
            await LoadAppsAsync();

            return _appDirectory.Select(kvp => new AppAnalysisResult
            {
                AppName = kvp.Key,
                FullName = kvp.Value
            }).ToList();
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.AI
{
    internal class AskCopilot : FeatureBase
    {
        private const string keyPath = @"Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked";
        private const string fullKeyPath = @"HKEY_CURRENT_USER\" + keyPath;
        private const string valueName = "{CB3B0003-8088-4EDE-8769-8B354AB2FF8C}";
        private const string displayValue = "Ask Copilot";

        public override string GetFeatureDetails()
        {
            return $"{fullKeyPath} | Value: {valueName} = \"{displayValue}\" | Blocks Copilot context menu entry.";
        }

        public override string ID()
        {
            return "Remove Ask Copilot from context menu";
        }

        public override string Info()
        {
            return "Blocks the 'Ask Copilot' entry in the Windows 11 context menu by disabling its Shell Extension.";
        }

        public override Task<bool> CheckFeature()
        {
            using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyPath))
            {
                if (key == null) return Task.FromResult(false);
                object value = key.GetValue(valueName);
                return Task.FromResult(value != null && value.ToString() == displayValue);
            }
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                using (RegistryKey key = Registry.CurrentUser.CreateSubKey(keyPath))
                {
                    key.SetValue(valueName, displayValue, RegistryValueKind.String);
                }

                Logger.Log("'Ask Copilot' context menu entry has been blocked.", LogLevel.Info);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error blocking Copilot context menu: " + ex.Message, LogLevel.Error);
                return Task.FromResult(false);
            }
        }

        public override bool UndoFeature()
        {
            try
            {
                using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyPath, writable: true))
                {
                    key?.DeleteValue(valueName, false);
                }

                Logger.Log("'Ask Copilot' context menu entry has been restored.", LogLevel.Info);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Error restoring Copilot context menu: " + ex.Message, LogLevel.Error);
                return false;
            }
        }
    }
}

using CFixer;
using CFixer.Properties;
using CFixer.Views;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CrapFixer
{
    public partial class MainForm : Form
    {
        private NavigationManager _navigationManager;
        private NavigationHandler _navigationHandler;
        private LogActions _logActions;
        private LogActionsController _logActionsController;
        private readonly AppManagerService _appManager = new AppManagerService();

        public MainForm()
        {
            InitializeComponent();
            IniStateManager.ApplyWindowState(this);

            // Set up the main navigation manager and logger
            _navigationManager = new NavigationManager(panelContainer);
            Logger.OutputBox = rtbLogger;

            // Set up log actions controller
            _logActions = new LogActions(rtbLogger);
        }

        private async void MainForm_Shown(object sender, EventArgs e)
        {
            await InitializeUI(); // _ = InitializeUI();
            InitializeAppState();
        }

        private void InitializeAppState()
        {
            // Load features and plugins into the tree view
            FeatureNodeManager.LoadFeatures(treeFeatures);
            PluginManager.LoadPlugins(treeFeatures);

            // Load settings from INI file if enabled
            IniStateManager.LoadFeaturesIfEnabled(treeFeatures);
        }

        private async Task InitializeUI()
        {
            // Initialize the navigation handler with buttons
            _navigationHandler = new NavigationHandler(btnFixer, btnRestore, btnTools, btnGitHub);

            // Load navigation icons
            await _navigationHandler.LoadNavigationIcons();

            // Register navigation handler
            _navigationHandler.NavigationButtonClicked += NavigationHandler_NavigationButtonClicked;

            // Register click handlers for GitHub links
            pictureHeader.Click += PictureHeader_Click;
            lblHeader.Click += PictureHeader_Click;

            // Re-initialize log actions controller (optional if not changed)
            _logActionsController = new LogActionsController(comboLogActions, _logActions);

            // Set version and OS info
            lblVersionInfo.Text = $"v{Program.GetAppVersion()} ";
            lblOSInfo.Text = await OSHelper.OSHelper.GetWindowsVersion();
        }

        // Handles navigation button clicks and switches views accordingly
        private void NavigationHandler_NavigationButtonClicked(Button button)
        {
            if (button == btnFixer)
            {
                _navigationManager.GoToMain();
            }
            else if (button == btnTools)
            {
                _navigationManager.SwitchView(new OptionsView());
            }
        }

        private async void btnAnalyze_Click(object sender, EventArgs e)
        {
            // Analyze features
            await FeatureNodeManager.AnalyzeAll(treeFeatures.Nodes);

            // Analyze plugins
            await PluginManager.AnalyzeAllPlugins(treeFeatures.Nodes);

            // Analyze apps
            await AnalyzeApps();

            // Show log actions combo box
            comboLogActions.Visible = true;
        }

        /// <summary>
        /// Analyzes the apps and logs the results.
        /// </summary>
        private async Task AnalyzeApps()
        {
            checkedListBoxApps.Items.Clear();

            // Try loading patterns from CFEnhancer.txt (located in Plugins folder)
            var (bloatwarePatterns, whitelistPatterns, scanAll) = _appManager.LoadExternalBloatwarePatterns();

            if (bloatwarePatterns.Length == 0 && !scanAll)
            {
                // Fallback to internal resource if external file not found or empty and scanAll is not enabled
                bloatwarePatterns = Resources.PredefinedApps?
                    .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(s => s.Trim().ToLower()).ToArray() ?? Array.Empty<string>();

                whitelistPatterns = Array.Empty<string>();
                Logger.Log("Using built-in bloatware list.", LogLevel.Info);
            }
            else
            {
                Logger.Log("🔎 Plugin ready: CFEnhancer (external bloatware list)", LogLevel.Info);
            }

            // Analyze installed apps based on patterns and whitelist, and optionally scan all
            var apps = await _appManager.AnalyzeAndLogAppsAsync(bloatwarePatterns, whitelistPatterns, scanAll);

            foreach (var app in apps)
            {
                checkedListBoxApps.Items.Add(app.FullName);
            }
        }

        private async void btnFix_Click(object sender, EventArgs e)
        {
            rtbLogger.Clear();

            // Fix all features
            foreach (TreeNode node in treeFeatures.Nodes)
                await FeatureNodeManager.FixChecked(node);

            // Fix all plugins
            foreach (TreeNode node in treeFeatures.Nodes)
                await PluginManager.FixChecked(node);

            // Fix selected Store apps
            var selectedApps = checkedListBoxApps.CheckedItems.Cast<string>().ToList();
            if (selectedApps.Count == 0)
                return;

            var appService = new AppManagerService();
            var removedApps = await appService.UninstallSelectedAppsAsync(selectedApps);

            // Update UI after uninstall
            foreach (var app in removedApps)
            {
                checkedListBoxApps.Items.Remove(app);
            }
        }

        private void btnRestore_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show(
           "⚠ This will restore all selected features to their original state.\n" +
           "Changes made by previous configurations may be reverted.\n\n" +
           "Are you sure you want to proceed?",
           "Restore Selected Features",
           MessageBoxButtons.YesNo,
           MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                rtbLogger.Clear();
                foreach (TreeNode node in treeFeatures.Nodes)
                    FeatureNodeManager.RestoreChecked(node);

                Logger.Log("↩ All selected features have been restored.", LogLevel.Info);
            }
        }

        /// <summary>
        /// Analyzes all plugins and features starting from the selected node from the context menu.
        /// </summary>
        private async void analyzeMarkedFeatureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeFeatures.SelectedNode is TreeNode selectedNode)
            {
                Logger.Log($"🔎 Analyzing Feature: {selectedNode.Text}", LogLevel.Info);

                // If a single node is selected (leaf node with no children),
                // always analyze this node regardless of its Checked state.
                if (selectedNode.Nodes.Count == 0)
                {
                    await PluginManager.AnalyzePlugin(selectedNode);
                }
                else
                {
                    // If a parent node is selected (has children),
                    // recursively analyze only the checked plugin nodes.
                    await PluginManager.AnalyzeAll(selectedNode);
                }

                // Perform feature-specific analysis (non-plugin)
                FeatureNodeManager.AnalyzeFeature(selectedNode);
            }
        }

        /// <summary>
        /// Fixes all checked plugin and feature nodes starting from the selected node from the context menu.
        /// </summary>
        private async void fixMarkedFeatureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeFeatures.SelectedNode is TreeNode selectedNode)
            {
                Logger.Log($"🔧 Fixing Feature: {selectedNode.Text}", LogLevel.Info);

                // Recursively fix all checked feature nodes (non-plugin)
                await FeatureNodeManager.FixFeature(selectedNode);

                // Recursively fix all checked plugin nodes starting from the selected node
                await PluginManager.FixPlugin(selectedNode);
            }
        }

        /// <summary>
        /// Restores the selected plugin or feature to its previous state from the context menu.
        /// </summary>
        private async void restoreMarkedFeatureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeFeatures.SelectedNode is TreeNode selectedNode)
            {
                if (PluginManager.IsPluginNode(selectedNode))
                    // Restore the plugin using its Undo command if available!
                    await PluginManager.RestorePlugin(selectedNode);
                else
                    Logger.Log($"↩ Restoring Feature: {selectedNode.Text}", LogLevel.Info);

                // Perform feature-specific restore (non-plugin)
                FeatureNodeManager.RestoreFeature(selectedNode);
            }
        }

        private void helpMarkedFeatureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeFeatures.SelectedNode is TreeNode selectedNode)
            {
                FeatureNodeManager.ShowHelp(selectedNode);
            }
        }

        /// <summary>
        /// Checks or unchecks all child nodes when a parent node is checked/unchecked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void treeFeatures_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (e.Action != TreeViewAction.Unknown)
            {
                foreach (TreeNode child in e.Node.Nodes)
                    child.Checked = e.Node.Checked;
            }
        }

        private void treeFeatures_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                // Get the node under the mouse cursor
                TreeNode nodeUnderMouse = treeFeatures.GetNodeAt(e.X, e.Y);

                if (nodeUnderMouse != null)
                {
                    treeFeatures.SelectedNode = nodeUnderMouse;

                    // Show the context menu at the mouse position
                    contextMenuStrip.Show(treeFeatures, e.Location);
                }
            }
        }

        /// <summary>
        /// Handles the link click event for selecting or deselecting all items in the list.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private bool treeChecked = false;

        private void linkSelection_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (tabControl.SelectedTab == Windows)
            {
                foreach (TreeNode node in treeFeatures.Nodes)
                {
                    node.Checked = treeChecked;
                    foreach (TreeNode child in node.Nodes)
                    {
                        child.Checked = treeChecked;
                        foreach (TreeNode grandChild in child.Nodes)
                            grandChild.Checked = treeChecked;
                    }
                }

                treeChecked = !treeChecked;
            }
            else if (tabControl.SelectedTab == Apps)
            {
                bool shouldCheck = checkedListBoxApps.Items.Cast<object>()
                    .Any(item => checkedListBoxApps.GetItemChecked(checkedListBoxApps.Items.IndexOf(item)) == false);

                for (int i = 0; i < checkedListBoxApps.Items.Count; i++)
                {
                    checkedListBoxApps.SetItemChecked(i, shouldCheck);
                }
            }
        }

        private void panelHeader_Paint(object sender, PaintEventArgs e)
        {
            var panel = sender as Panel;
            var g = e.Graphics;

            // Solid background: #4D4D4D
            g.Clear(Color.FromArgb(77, 77, 77));

            // Inset line effect (3D-like): light line + shadow line
            Color baseColor = Color.FromArgb(80, 80, 80); // inset base

            using (var topLine = new Pen(ControlPaint.Light(baseColor, 0.0f)))
            using (var bottomLine = new Pen(ControlPaint.Dark(baseColor, 0.2f)))
            {
                g.SmoothingMode = SmoothingMode.None;
                g.DrawLine(topLine, 0, panel.Height - 2, panel.Width, panel.Height - 2);
                g.DrawLine(bottomLine, 0, panel.Height - 1, panel.Width, panel.Height - 1);
            }
        }

        // Handles click on the header image to open the GitHub page
        private void PictureHeader_Click(object sender, EventArgs e)
        {
            Utils.OpenGitHubPage(sender, e);
        }

        // Handles link click to check for updates
        private void linkUpdateCheck_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var updateUrl = $"https://builtbybel.github.io/CrapFixer/update-check.html?version={Program.GetAppVersion()}";

            var psi = new ProcessStartInfo
            {
                FileName = updateUrl,
                UseShellExecute = true
            };
            Process.Start(psi);
        }

        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (IniStateManager.IsViewSettingEnabled("SETTINGS", "checkSaveToINI"))
            {
                IniStateManager.Save(treeFeatures, this);
            }

            Logger.OutputBox = null; // Remove reference
        }

        private void btnGitHub_Click(object sender, EventArgs e)
        {
            _navigationManager.SwitchView(new OptionsView());
        }
    }
}

using CrapFixer;
using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace Views
{
    public partial class AboutView : UserControl

    {
        public AboutView()
        {
            InitializeComponent();
            InitializeUI();
        }

        private void InitializeUI()
        {
            // Update version label
            this.lblVersionInfo.Text = $"v{Program.GetAppVersion()} ";

            // Populate amount choices
            comboBoxAmount.Items.AddRange(new object[] { "3.50", "5", "10",
                                                          "12", "15", "16",
                                                          "17", "18","20",
                                                          "25", "30", "35",
                                                          "40", "50", "60",
                                                          "70", "80", "100"});
            comboBoxAmount.SelectedIndex = 2;

            // Populate currency options
            comboBoxCurrency.Items.AddRange(new object[] { "EUR", "USD", "GBP", "CAD", "AUD", "CHF" });
            comboBoxCurrency.SelectedIndex = 0;
        }

        private void linkGitHub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://github.com/builtbybel/CrapFixer/releases");
        }

        private void btnDonate_Click(object sender, EventArgs e)
        {
            string amount = comboBoxAmount.SelectedItem?.ToString();
            string currency = comboBoxCurrency.SelectedItem?.ToString();

            if (string.IsNullOrEmpty(amount) || string.IsNullOrEmpty(currency))
            {
                MessageBox.Show("Please select an amount and a currency.");
                return;
            }

            string email = "belim@builtbybel.com";
            string purpose = Uri.EscapeDataString("Support Development of the CrapFixer app.");

            string returnUrl = Uri.EscapeDataString("https://github.com/Belim/support");
            string cancelUrl = Uri.EscapeDataString("https://github.com/builtbybel/CrapFixer");

            string url = $"https://www.paypal.com/cgi-bin/webscr?cmd=_donations" +
                         $"&business={Uri.EscapeDataString(email)}" +
                         $"&amount={amount}" +
                         $"&currency_code={currency}" +
                         $"&item_name={purpose}" +
                         $"&return={returnUrl}" +
                         $"&cancel_return={cancelUrl}";

            System.Diagnostics.Process.Start(new ProcessStartInfo
            {
                FileName = url,
                UseShellExecute = true
            });
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;

public static class IniStateManager
{
    // CrapFixer.ini path
    private static readonly string IniPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CrapFixer.ini");

    private static readonly object FileLock = new object();

    // Saves the global states (App size, TreeView nodes states)
    public static void Save(TreeView tree, Form form)
    {
        lock (FileLock)
        {
            // Read existing lines if file exists
            var lines = File.Exists(IniPath) ? File.ReadAllLines(IniPath).ToList() : new List<string>();

            // Remove old APP and FEATURES sections
            RemoveSection(lines, "APP");
            RemoveSection(lines, "FEATURES");

            // Append new APP section
            lines.Add("[APP]");
            lines.Add($"Width={form.Width}");
            lines.Add($"Height={form.Height}");
            lines.Add($"Top={form.Top}");
            lines.Add($"Left={form.Left}");
            //  lines.Add(""); // empty line for spacing

            // Append new FEATURES section (TreeView nodes states)
            lines.Add("[FEATURES]");
            AppendNodeStates(lines, tree.Nodes);

            // Write all back
            File.WriteAllLines(IniPath, lines);
        }
    }

    // Removes a section from the INI content
    private static void RemoveSection(List<string> lines, string sectionName)
    {
        int start = lines.FindIndex(l => l.Trim().Equals($"[{sectionName}]", StringComparison.OrdinalIgnoreCase));
        if (start < 0) return;

        int end = start + 1;
        while (end < lines.Count && !lines[end].TrimStart().StartsWith("["))
            end++;

        lines.RemoveRange(start, end - start);
    }

    // Helper to write TreeNode states to a list of strings
    private static void AppendNodeStates(List<string> lines, TreeNodeCollection nodes)
    {
        foreach (TreeNode node in nodes)
        {
            lines.Add($"{node.Text.Trim()}={node.Checked}");
            if (node.Nodes.Count > 0)
                AppendNodeStates(lines, node.Nodes);
        }
    }

    // Loads the global states (App size, TreeView nodes states) if enabled
    public static void LoadFeaturesIfEnabled(TreeView tree)
    {
        if (IsViewSettingEnabled("SETTINGS", "checkSaveToINI"))
            LoadFeatureStates(tree);
    }

    public static void ApplyWindowState(Form form)
    {
        if (File.Exists(IniPath))
        {
            // Load window size and position from INI file
            LoadWindowState(form);
            form.StartPosition = FormStartPosition.Manual;
        }
        else
        {
            // If INI file doesn't exist, set default position
            form.StartPosition = FormStartPosition.CenterScreen;
        }
    }

    // Loads only the window size and position from the INI file
    public static void LoadWindowState(Form form)
    {
        if (!File.Exists(IniPath)) return;

        var lines = File.ReadAllLines(IniPath);
        var section = "";

        foreach (var line in lines)
        {
            var trimmed = line.Trim();
            if (string.IsNullOrWhiteSpace(trimmed)) continue;

            // Check if line is a section header
            if (trimmed.StartsWith("[") && trimmed.EndsWith("]"))
            {
                section = trimmed;
                continue;
            }

            if (section == "[APP]")
            {
                // Split line into key and value
                var parts = trimmed.Split(new[] { '=' }, 2);
                if (parts.Length != 2) continue;

                var key = parts[0].Trim();
                var value = parts[1].Trim();

                // Parse and apply window size and position
                if (int.TryParse(value, out int size))
                {
                    if (key.Equals("Width", StringComparison.OrdinalIgnoreCase))
                        form.Width = size;
                    else if (key.Equals("Height", StringComparison.OrdinalIgnoreCase))
                        form.Height = size;
                    else if (key.Equals("Top", StringComparison.OrdinalIgnoreCase))
                        form.Top = size;
                    else if (key.Equals("Left", StringComparison.OrdinalIgnoreCase))
                        form.Left = size;
                }
            }
        }
    }

    // Loads only the feature states (TreeView node checked states) from the INI file
    public static void LoadFeatureStates(TreeView tree)
    {
        if (!File.Exists(IniPath)) return;

        var lines = File.ReadAllLines(IniPath);
        var section = "";
        var states = new Dictionary<string, bool>();

        foreach (var line in lines)
        {
            var trimmed = line.Trim();
            if (string.IsNullOrWhiteSpace(trimmed)) continue;

            // Check if line is a section header
            if (trimmed.StartsWith("[") && trimmed.EndsWith("]"))
            {
                section = trimmed;
                continue;
            }

            if (section == "[FEATURES]")
            {
                // Split line into key and value
                var parts = trimmed.Split(new[] { '=' }, 2);
                if (parts.Length != 2) continue;

                var key = parts[0].Trim();
                var value = parts[1].Trim();

                // Save checked state for each feature node
                states[key] = value.ToLower() == "true";
            }
        }

        // Apply saved feature states to the TreeView nodes recursively
        ApplyStates(tree.Nodes, states);
    }

    // Applies the saved states to the TreeView nodes
    private static void ApplyStates(TreeNodeCollection nodes, Dictionary<string, bool> states)
    {
        foreach (TreeNode node in nodes)
        {
            string nodeName = node.Text.Trim();
            if (states.ContainsKey(nodeName))
                node.Checked = states[nodeName];

            if (node.Nodes.Count > 0)
                ApplyStates(node.Nodes, states);
        }
    }

    // Saves individual settings (like checkbox states) for a specific view
    public static void SaveViewSettings(string viewName, Dictionary<string, bool> settings)
    {
        lock (FileLock)
        {
            var lines = File.Exists(IniPath) ? File.ReadAllLines(IniPath).ToList() : new List<string>();

            // Remove previous section to avoid duplicates
            RemoveSection(lines, viewName);

            // Append new section with updated settings
            lines.Add($"[{viewName}]");
            foreach (var kvp in settings)
            {
                lines.Add($"{kvp.Key}={kvp.Value}");
            }

            File.WriteAllLines(IniPath, lines);
        }
    }

    // Loads individual settings for a specific view (e.g. checkboxes)
    public static Dictionary<string, bool> LoadViewSettings(string viewName)
    {
        var result = new Dictionary<string, bool>();
        if (!File.Exists(IniPath)) return result;

        var lines = File.ReadAllLines(IniPath);
        bool inTargetSection = false;

        foreach (var line in lines)
        {
            var trimmed = line.Trim();
            if (string.IsNullOrWhiteSpace(trimmed)) continue;

            // Check if we are in the desired view section
            if (trimmed.StartsWith("[") && trimmed.EndsWith("]"))
            {
                inTargetSection = trimmed.Equals($"[{viewName}]", StringComparison.OrdinalIgnoreCase);
                continue;
            }

            if (!inTargetSection) continue;

            var parts = trimmed.Split(new[] { '=' }, 2);
            if (parts.Length != 2) continue;

            var key = parts[0].Trim();
            var value = parts[1].Trim();

            result[key] = value.ToLower() == "true";
        }

        return result;
    }

    // Checks if a setting exists in a specific section
    public static bool IsViewSettingEnabled(string sectionName, string settingName)
    {
        var settings = LoadViewSettings(sectionName);
        return settings.ContainsKey(settingName) && settings[settingName];
    }
}

/// <summary>
/// Extension methods for IDictionary to provide default value retrieval.
/// </summary>
public static class DictionaryExtensions
{
    public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, TValue defaultValue = default)
    {
        return dict.TryGetValue(key, out var value) ? value : defaultValue;
    }
}

using CrapFixer;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Threading.Tasks;

namespace Settings.System
{
    internal class WingetUpgradeAll : FeatureBase
    {
        public override string GetFeatureDetails()
        {
            return "winget upgrade --include-unknown";
        }

        public override string ID()
        {
            return "Winget App Updates";
        }

        public override string Info()
        {
            return "Automatically searches for available app updates using the Windows package manager 'winget' and installs them in a new Windows Terminal window. It runs 'winget upgrade --include-unknown' to list all available updates, including manually installed apps, and then 'winget upgrade --all --include-unknown' to install them. No manual interaction is required.";
        }

        public override async Task<bool> CheckFeature()
        {
            Logger.Log("📦 Checking all available updates via winget...", LogLevel.Warning);
            Logger.Log("This may take a while, please be patient.", LogLevel.Warning);

            try
            {
                string output = await ExecuteCommand("winget upgrade --include-unknown" );

                Logger.Log("Winget upgrade check:\n" + output, LogLevel.Info, new Font("Cascadia Mono", 8.25f));

                return output.ToLower().Contains("available");
            }
            catch (Exception ex)
            {
                Logger.Log("Winget check failed: " + ex.Message, LogLevel.Error);
                return false;
            }
        }

        public override Task<bool> DoFeature()
        {
            return Task.Factory.StartNew(() =>
            {
                try
                {
                    LaunchInTerminal("winget upgrade --all --include-unknown");
                    return true;
                }
                catch (Exception ex)
                {
                    Logger.Log("Failed to run winget upgrade: " + ex.Message, LogLevel.Error);
                    return false;
                }
            });
        }

        public override bool UndoFeature()
        {
            Logger.Log("Winget upgrades cannot be undone.", LogLevel.Warning);
            return false;
        }

        private void LaunchInTerminal(string command)
        {
            var startInfo = new ProcessStartInfo
            {
                FileName = "wt.exe",
                Arguments = "-w 0 nt -p \"Windows PowerShell\" powershell -NoExit -Command \"" + command + "\"",
                UseShellExecute = true
            };

            Process.Start(startInfo);
        }

        private Task<string> ExecuteCommand(string command)
        {
            var tcs = new TaskCompletionSource<string>();

            try
            {
                var startInfo = new ProcessStartInfo
                {
                    FileName = "cmd.exe",
                    Arguments = "/c " + command,
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    RedirectStandardError = true,
                    CreateNoWindow = true
                };

                var process = new Process();
                process.StartInfo = startInfo;

                string output = "";

                process.OutputDataReceived += (sender, args) =>
                {
                    if (args.Data != null)
                        output += args.Data + Environment.NewLine;
                };

                process.EnableRaisingEvents = true;
                process.Exited += (sender, args) =>
                {
                    tcs.TrySetResult(output);
                    process.Dispose();
                };

                process.Start();
                process.BeginOutputReadLine();
            }
            catch (Exception ex)
            {
                tcs.TrySetException(ex);
            }

            return tcs.Task;
        }
    }
}

using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Diagnostics;
using CrapFixer;

namespace Settings.Issues
{
    internal class BasicCleanup : FeatureBase
    {
        private readonly string tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Temp");
        private const int cleanupSetNumber = 1;

        public override string ID() => "Basic Disk Cleanup";

        public override string Info() => "Deletes all temporary files from the user's Temp folder. Then, the built-in Disk Cleanup utility (cleanmgr) is run.";

        public override Task<bool> CheckFeature()
        {
            try
            {
                var totalSize = GetDirectorySize(tempPath);

                bool isOk = totalSize <= 50;

                return Task.FromResult(isOk);
            }
            catch (Exception ex)
            {
                Logger.Log($"Error checking Temp folder: {ex.Message}", LogLevel.Error);
                return Task.FromResult(false);
            }
        }

        public override string GetFeatureDetails()
        {
            try
            {
                var totalSize = GetDirectorySize(tempPath);
                return $"Temp folder size: {totalSize} MB (including cleanmgr /sagerun:1 in the next run)";
            }
            catch (Exception ex)
            {
                Logger.Log($"Error accessing Temp folder: {ex.Message}", LogLevel.Error);
                return $"Temp folder not accessible: {tempPath}";
            }
        }

        public override async Task<bool> DoFeature()
        {
            try
            {
                await CleanTempFolderAsync();
                await RunDiskCleanup();
                Logger.Log("Basic Cleanup completed successfully.", LogLevel.Info);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log($"Error cleaning Temp folder: {ex.Message}", LogLevel.Warning);
                return false;
            }
        }

        private async Task CleanTempFolderAsync()
        {
            var files = await Task.Run(() => Directory.GetFiles(tempPath, "*", SearchOption.AllDirectories));
            var dirs = await Task.Run(() => Directory.GetDirectories(tempPath, "*", SearchOption.AllDirectories));

            foreach (var file in files)
            {
                try
                {
                    await Task.Run(() => File.Delete(file));
                    Logger.Log($"Deleted file: {file}", LogLevel.Info);
                }
                catch (Exception ex)
                {
                    Logger.Log($"Error deleting file {file}: {ex.Message}", LogLevel.Warning);
                }
            }

            foreach (var dir in dirs)
            {
                try
                {
                    await Task.Run(() => Directory.Delete(dir, true));
                    Logger.Log($"Deleted directory: {dir}", LogLevel.Info);
                }
                catch (Exception ex)
                {
                    Logger.Log($"Error deleting directory {dir}: {ex.Message}", LogLevel.Warning);
                }
            }
        }

        // calculate the size of the directory in MB
        private long GetDirectorySize(string directory)
        {
            try
            {
                var directoryInfo = new DirectoryInfo(directory);
                long size = 0;

                // Calculate size of all files
                size += directoryInfo.GetFiles("*", SearchOption.AllDirectories).Sum(file => file.Length);

                return size / (1024 * 1024);                 // return size in MB
            }
            catch (Exception ex)
            {
                Logger.Log($"Error calculating directory size: {ex.Message}", LogLevel.Warning);
                return 0;
            }
        }

        private async Task RunDiskCleanup()
        {
            try
            {
                Logger.Log("Running Disk Cleanup utility (cleanmgr)...", LogLevel.Info);

                var sageSetCmd = $"cleanmgr.exe /sageset:{cleanupSetNumber}";
                var startInfo1 = new ProcessStartInfo("cmd", $"/c {sageSetCmd}")
                {
                    CreateNoWindow = true,
                    UseShellExecute = false
                };

                var sageRunCmd = $"cleanmgr.exe /sagerun:{cleanupSetNumber}";
                var veryLowDiskCmd = $"cleanmgr.exe /verylowdisk";
                var startInfo2 = new ProcessStartInfo("cmd", $"/c {sageRunCmd} {veryLowDiskCmd}")
                {
                    CreateNoWindow = true,
                    UseShellExecute = false
                };

                using (var process1 = Process.Start(startInfo1))
                {
                    if (process1 != null)
                        await Task.Run(() => process1.WaitForExit());
                }

                using (var process2 = Process.Start(startInfo2))
                {
                    if (process2 != null)
                        await Task.Run(() => process2.WaitForExit());
                }
            }
            catch (Exception ex)
            {
                Logger.Log($"Error running Disk Cleanup: {ex.Message}", LogLevel.Warning);
            }
        }

        // Undo method: Cleanup cannot be undone, so return false
        public override bool UndoFeature() => false;
    }
}

using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace CrapFixer
{
    internal static class Utils
    {
        private const string GitHubUrl = "https://github.com/builtbybel/CrapFixer";

        /// <summary>
        /// Checks if a registry value equals a specified integer.
        /// </summary>
        public static bool IntEquals(string keyName, string valueName, int expectedValue)
        {
            try
            {
                object value = Registry.GetValue(keyName, valueName, null);
                return value is int intValue && intValue == expectedValue;
            }
            catch (Exception ex)
            {
                Logger.Log($"Registry check failed for {keyName}\\{valueName}: {ex.Message}", LogLevel.Error);
                return false;
            }
        }

        /// <summary>
        /// Checks if a registry value equals a specified string.
        /// </summary>
        public static bool StringEquals(string keyName, string valueName, string expectedValue)
        {
            try
            {
                object value = Registry.GetValue(keyName, valueName, null);
                return value is string strValue && strValue == expectedValue;
            }
            catch (Exception ex)
            {
                Logger.Log($"Registry check failed for {keyName}\\{valueName}: {ex.Message}", LogLevel.Error);
                return false;
            }
        }

        /// <summary>
        /// Opens the GitHub project page in the default browser.
        /// </summary>
        public static void OpenGitHubPage(object sender, EventArgs e)
        {
            try
            {
                Process.Start(new ProcessStartInfo
                {
                    FileName = GitHubUrl,
                    UseShellExecute = true
                });
            }
            catch (Exception ex)
            {
                Logger.Log($"Failed to open GitHub page: {ex.Message}", LogLevel.Error);
            }
        }

        /// <summary>
        /// Restarts Windows Explorer to apply UI changes.
        /// </summary>
        public static void RestartExplorer()
        {
            try
            {
                Logger.Log("Restarting Windows Explorer to apply UI changes...", LogLevel.Info);

                foreach (var process in Process.GetProcessesByName("explorer"))
                {
                    process.Kill();
                    process.WaitForExit();
                }

                Process.Start("explorer.exe");
                Logger.Log("Explorer restarted successfully.", LogLevel.Info);
            }
            catch (Exception ex)
            {
                Logger.Log($"Failed to restart Explorer: {ex.Message}", LogLevel.Error);
            }
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.AI
{
    internal class Recall : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsAI";
        private const string valueName = "AllowRecallEnablement";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended: {recommendedValue} (Recall off – protect your privacy, prevent AI from accessing personal data)";
        }

        public override string ID()
        {
            return "Turn off Recall in Windows 11";
        }

        public override string Info()
        {
            return "This will remove Recall from Windows 11 24H2";
        }

        public override Task<bool> CheckFeature()
        {
            // Check if reg key exists
            object value = Registry.GetValue(keyName, valueName, null);
            if (value == null)
            {
                // Key does not exist, turn off feature
                return Task.FromResult(false);
            }

            // Key exists, check if value is desired value
            return Task.FromResult((int)value == recommendedValue);
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, Microsoft.Win32.RegistryValueKind.DWord);
                Logger.Log("You've even disabled system-wide Snapshots for all users now.", LogLevel.Info);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Personalization
{
    internal class FullContextMenus : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\SOFTWARE\CLASSES\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32";

        public override string GetFeatureDetails()
        {
            return $"{keyName}";
        }

        public override string ID()
        {
            return "Show Full context menus in Windows 11";
        }

        public override string Info()
        {
            return "This feature will enable full context menus";
        }

        public override Task<bool> CheckFeature()
        {
            try
            {
                object value = Registry.GetValue(keyName, "", null);
                return Task.FromResult(value != null); // Return true if value is not null
            }
            catch (Exception ex)
            {
                Logger.Log("Error occurred while checking: " + ex.Message, LogLevel.Error);
                return Task.FromResult(false);
            }
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, "", "", RegistryValueKind.String);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error occurred while enabling: " + ex.Message, LogLevel.Error);
                return Task.FromResult(false);
            }
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.CurrentUser.DeleteSubKeyTree(@"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}", false);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Error occurred while disabling: " + ex.Message, LogLevel.Error);
                return false;
            }
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.System
{
    internal class NetworkThrottling : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile";
        private const string valueName = "NetworkThrottlingIndex";
        private const int recommendedValue = -1; // 0xFFFFFFFF

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: 0xFFFFFFFF (decimal: {uint.MaxValue})";
        }

        public override string ID()
        {
            return "Disable Network Throttling";
        }

        public override string Info()
        {
            return "Disables the Windows network throttling mechanism to potentially improve performance for streaming, gaming, or real-time applications.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, unchecked((int)0xFFFFFFFF)));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, unchecked((int)0xFFFFFFFF), RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 10, RegistryValueKind.DWord); // Default is 10
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.System
{
    internal class SystemResponsiveness : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile";
        private const string valueName = "SystemResponsiveness";
        private const int recommendedValue = 10;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Optimize System Responsiveness";
        }

        public override string Info()
        {
            return "Enhances system responsiveness by prioritizing CPU resources for foreground tasks, improving performance during active use.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 20, RegistryValueKind.DWord); // Default is typically 20 on Windows 11
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.System
{
    internal class VerboseStatus : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
        private const string valueName = "VerboseStatus";
        private const int recommendedValue = 1;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Enable Verbose Logon status messages";
        }

        public override string Info()
        {
            return "This method allows you to see what processes are hanging when shutting down and turning on the machine.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
               Utils.IntEquals(keyName, valueName, recommendedValue)
         );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

namespace CrapFixer
{
    partial class MainForm
    {
        /// <summary>
        /// Erforderliche Designervariable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Vom Windows Form-Designer generierter Code

        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.panelContainer = new System.Windows.Forms.Panel();
            this.panelContent = new System.Windows.Forms.Panel();
            this.btnAnalyze = new System.Windows.Forms.Button();
            this.tabControl = new System.Windows.Forms.TabControl();
            this.Windows = new System.Windows.Forms.TabPage();
            this.treeFeatures = new System.Windows.Forms.TreeView();
            this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.analyzeMarkedFeatureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.fixMarkedFeatureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.restoreMarkedFeatureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.seperatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator();
            this.helpMarkedFeatureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.Apps = new System.Windows.Forms.TabPage();
            this.checkedListBoxApps = new System.Windows.Forms.CheckedListBox();
            this.groupBox = new System.Windows.Forms.GroupBox();
            this.comboLogActions = new System.Windows.Forms.ComboBox();
            this.rtbLogger = new System.Windows.Forms.RichTextBox();
            this.btnFix = new System.Windows.Forms.Button();
            this.panelHeader = new System.Windows.Forms.Panel();
            this.btnGitHub = new System.Windows.Forms.Button();
            this.lblOSInfo = new System.Windows.Forms.Label();
            this.lblVersionInfo = new System.Windows.Forms.Label();
            this.lblHeader = new System.Windows.Forms.Label();
            this.pictureHeader = new System.Windows.Forms.PictureBox();
            this.btnRestore = new System.Windows.Forms.Button();
            this.linkUpdateCheck = new System.Windows.Forms.LinkLabel();
            this.btnTools = new System.Windows.Forms.Button();
            this.btnFixer = new System.Windows.Forms.Button();
            this.linkSelection = new System.Windows.Forms.LinkLabel();
            this.toolTip = new System.Windows.Forms.ToolTip(this.components);
            this.panelContainer.SuspendLayout();
            this.panelContent.SuspendLayout();
            this.tabControl.SuspendLayout();
            this.Windows.SuspendLayout();
            this.contextMenuStrip.SuspendLayout();
            this.Apps.SuspendLayout();
            this.groupBox.SuspendLayout();
            this.panelHeader.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureHeader)).BeginInit();
            this.SuspendLayout();
            //
            // panelContainer
            //
            this.panelContainer.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.panelContainer.BackColor = System.Drawing.SystemColors.Control;
            this.panelContainer.Controls.Add(this.panelContent);
            this.panelContainer.Location = new System.Drawing.Point(90, 69);
            this.panelContainer.Name = "panelContainer";
            this.panelContainer.Size = new System.Drawing.Size(613, 375);
            this.panelContainer.TabIndex = 198;
            //
            // panelContent
            //
            this.panelContent.AutoScroll = true;
            this.panelContent.BackColor = System.Drawing.Color.White;
            this.panelContent.Controls.Add(this.btnAnalyze);
            this.panelContent.Controls.Add(this.tabControl);
            this.panelContent.Controls.Add(this.groupBox);
            this.panelContent.Controls.Add(this.btnFix);
            this.panelContent.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panelContent.Location = new System.Drawing.Point(0, 0);
            this.panelContent.Name = "panelContent";
            this.panelContent.Size = new System.Drawing.Size(613, 375);
            this.panelContent.TabIndex = 205;
            //
            // btnAnalyze
            //
            this.btnAnalyze.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.btnAnalyze.AutoEllipsis = true;
            this.btnAnalyze.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.btnAnalyze.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btnAnalyze.Location = new System.Drawing.Point(268, 339);
            this.btnAnalyze.Name = "btnAnalyze";
            this.btnAnalyze.Size = new System.Drawing.Size(121, 29);
            this.btnAnalyze.TabIndex = 1;
            this.btnAnalyze.Text = "&Analyze";
            this.btnAnalyze.UseVisualStyleBackColor = false;
            this.btnAnalyze.Click += new System.EventHandler(this.btnAnalyze_Click);
            //
            // tabControl
            //
            this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)));
            this.tabControl.Controls.Add(this.Windows);
            this.tabControl.Controls.Add(this.Apps);
            this.tabControl.ItemSize = new System.Drawing.Size(68, 21);
            this.tabControl.Location = new System.Drawing.Point(7, 5);
            this.tabControl.Name = "tabControl";
            this.tabControl.SelectedIndex = 0;
            this.tabControl.ShowToolTips = true;
            this.tabControl.Size = new System.Drawing.Size(255, 363);
            this.tabControl.SizeMode = System.Windows.Forms.TabSizeMode.FillToRight;
            this.tabControl.TabIndex = 199;
            //
            // Windows
            //
            this.Windows.AutoScroll = true;
            this.Windows.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
            this.Windows.Controls.Add(this.treeFeatures);
            this.Windows.Location = new System.Drawing.Point(4, 25);
            this.Windows.Name = "Windows";
            this.Windows.Size = new System.Drawing.Size(247, 334);
            this.Windows.TabIndex = 0;
            this.Windows.Text = "Windows";
            //
            // treeFeatures
            //
            this.treeFeatures.BackColor = System.Drawing.Color.White;
            this.treeFeatures.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.treeFeatures.CheckBoxes = true;
            this.treeFeatures.ContextMenuStrip = this.contextMenuStrip;
            this.treeFeatures.Dock = System.Windows.Forms.DockStyle.Fill;
            this.treeFeatures.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.treeFeatures.Location = new System.Drawing.Point(0, 0);
            this.treeFeatures.Name = "treeFeatures";
            this.treeFeatures.ShowLines = false;
            this.treeFeatures.ShowNodeToolTips = true;
            this.treeFeatures.ShowPlusMinus = false;
            this.treeFeatures.ShowRootLines = false;
            this.treeFeatures.Size = new System.Drawing.Size(247, 334);
            this.treeFeatures.TabIndex = 0;
            this.treeFeatures.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeFeatures_AfterCheck);
            this.treeFeatures.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeFeatures_MouseDown);
            //
            // contextMenuStrip
            //
            this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.analyzeMarkedFeatureToolStripMenuItem,
            this.fixMarkedFeatureToolStripMenuItem,
            this.restoreMarkedFeatureToolStripMenuItem,
            this.seperatorToolStripMenuItem,
            this.helpMarkedFeatureToolStripMenuItem});
            this.contextMenuStrip.Name = "contextManualMenu";
            this.contextMenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
            this.contextMenuStrip.Size = new System.Drawing.Size(119, 98);
            //
            // analyzeMarkedFeatureToolStripMenuItem
            //
            this.analyzeMarkedFeatureToolStripMenuItem.Name = "analyzeMarkedFeatureToolStripMenuItem";
            this.analyzeMarkedFeatureToolStripMenuItem.Size = new System.Drawing.Size(118, 22);
            this.analyzeMarkedFeatureToolStripMenuItem.Text = "Analyze";
            this.analyzeMarkedFeatureToolStripMenuItem.Click += new System.EventHandler(this.analyzeMarkedFeatureToolStripMenuItem_Click);
            //
            // fixMarkedFeatureToolStripMenuItem
            //
            this.fixMarkedFeatureToolStripMenuItem.Name = "fixMarkedFeatureToolStripMenuItem";
            this.fixMarkedFeatureToolStripMenuItem.Size = new System.Drawing.Size(118, 22);
            this.fixMarkedFeatureToolStripMenuItem.Text = "Fix";
            this.fixMarkedFeatureToolStripMenuItem.Click += new System.EventHandler(this.fixMarkedFeatureToolStripMenuItem_Click);
            //
            // restoreMarkedFeatureToolStripMenuItem
            //
            this.restoreMarkedFeatureToolStripMenuItem.Name = "restoreMarkedFeatureToolStripMenuItem";
            this.restoreMarkedFeatureToolStripMenuItem.Size = new System.Drawing.Size(118, 22);
            this.restoreMarkedFeatureToolStripMenuItem.Text = "Restore";
            this.restoreMarkedFeatureToolStripMenuItem.Click += new System.EventHandler(this.restoreMarkedFeatureToolStripMenuItem_Click);
            //
            // seperatorToolStripMenuItem
            //
            this.seperatorToolStripMenuItem.Name = "seperatorToolStripMenuItem";
            this.seperatorToolStripMenuItem.Size = new System.Drawing.Size(115, 6);
            //
            // helpMarkedFeatureToolStripMenuItem
            //
            this.helpMarkedFeatureToolStripMenuItem.Name = "helpMarkedFeatureToolStripMenuItem";
            this.helpMarkedFeatureToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1;
            this.helpMarkedFeatureToolStripMenuItem.Size = new System.Drawing.Size(118, 22);
            this.helpMarkedFeatureToolStripMenuItem.Text = "Help";
            this.helpMarkedFeatureToolStripMenuItem.Click += new System.EventHandler(this.helpMarkedFeatureToolStripMenuItem_Click);
            //
            // Apps
            //
            this.Apps.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
            this.Apps.Controls.Add(this.checkedListBoxApps);
            this.Apps.Location = new System.Drawing.Point(4, 25);
            this.Apps.Name = "Apps";
            this.Apps.Size = new System.Drawing.Size(247, 334);
            this.Apps.TabIndex = 1;
            this.Apps.Text = "Applications";
            //
            // checkedListBoxApps
            //
            this.checkedListBoxApps.BackColor = System.Drawing.Color.White;
            this.checkedListBoxApps.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.checkedListBoxApps.Dock = System.Windows.Forms.DockStyle.Fill;
            this.checkedListBoxApps.Font = new System.Drawing.Font("Tahoma", 8F);
            this.checkedListBoxApps.FormattingEnabled = true;
            this.checkedListBoxApps.Items.AddRange(new object[] {
            "No analysis yet"});
            this.checkedListBoxApps.Location = new System.Drawing.Point(0, 0);
            this.checkedListBoxApps.Name = "checkedListBoxApps";
            this.checkedListBoxApps.Size = new System.Drawing.Size(247, 334);
            this.checkedListBoxApps.Sorted = true;
            this.checkedListBoxApps.TabIndex = 336;
            //
            // groupBox
            //
            this.groupBox.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.groupBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(252)))), ((int)(((byte)(252)))));
            this.groupBox.Controls.Add(this.comboLogActions);
            this.groupBox.Controls.Add(this.rtbLogger);
            this.groupBox.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
            this.groupBox.Location = new System.Drawing.Point(268, 21);
            this.groupBox.Name = "groupBox";
            this.groupBox.Size = new System.Drawing.Size(334, 310);
            this.groupBox.TabIndex = 200;
            this.groupBox.TabStop = false;
            //
            // comboLogActions
            //
            this.comboLogActions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.comboLogActions.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
            this.comboLogActions.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboLogActions.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.comboLogActions.Font = new System.Drawing.Font("Tahoma", 8.25F);
            this.comboLogActions.FormattingEnabled = true;
            this.comboLogActions.Location = new System.Drawing.Point(7, 285);
            this.comboLogActions.Name = "comboLogActions";
            this.comboLogActions.Size = new System.Drawing.Size(319, 21);
            this.comboLogActions.TabIndex = 210;
            this.comboLogActions.Visible = false;
            //
            // rtbLogger
            //
            this.rtbLogger.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.rtbLogger.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(252)))), ((int)(((byte)(252)))));
            this.rtbLogger.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.rtbLogger.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.rtbLogger.Location = new System.Drawing.Point(7, 19);
            this.rtbLogger.Name = "rtbLogger";
            this.rtbLogger.Size = new System.Drawing.Size(319, 263);
            this.rtbLogger.TabIndex = 195;
            this.rtbLogger.Text = "";
            this.rtbLogger.WordWrap = false;
            //
            // btnFix
            //
            this.btnFix.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.btnFix.AutoEllipsis = true;
            this.btnFix.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.btnFix.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btnFix.Location = new System.Drawing.Point(482, 339);
            this.btnFix.Name = "btnFix";
            this.btnFix.Size = new System.Drawing.Size(121, 29);
            this.btnFix.TabIndex = 2;
            this.btnFix.Text = "Run &Fixer";
            this.btnFix.UseVisualStyleBackColor = false;
            this.btnFix.Click += new System.EventHandler(this.btnFix_Click);
            //
            // panelHeader
            //
            this.panelHeader.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(77)))), ((int)(((byte)(77)))));
            this.panelHeader.Controls.Add(this.btnGitHub);
            this.panelHeader.Controls.Add(this.lblOSInfo);
            this.panelHeader.Controls.Add(this.lblVersionInfo);
            this.panelHeader.Controls.Add(this.lblHeader);
            this.panelHeader.Controls.Add(this.pictureHeader);
            this.panelHeader.Dock = System.Windows.Forms.DockStyle.Top;
            this.panelHeader.Location = new System.Drawing.Point(0, 0);
            this.panelHeader.Name = "panelHeader";
            this.panelHeader.Size = new System.Drawing.Size(710, 61);
            this.panelHeader.TabIndex = 204;
            this.panelHeader.Paint += new System.Windows.Forms.PaintEventHandler(this.panelHeader_Paint);
            //
            // btnGitHub
            //
            this.btnGitHub.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnGitHub.AutoSize = true;
            this.btnGitHub.Cursor = System.Windows.Forms.Cursors.Hand;
            this.btnGitHub.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(170)))), ((int)(((byte)(210)))));
            this.btnGitHub.FlatAppearance.BorderSize = 0;
            this.btnGitHub.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnGitHub.Font = new System.Drawing.Font("Tahoma", 8F);
            this.btnGitHub.ForeColor = System.Drawing.Color.Gainsboro;
            this.btnGitHub.Location = new System.Drawing.Point(657, 7);
            this.btnGitHub.Name = "btnGitHub";
            this.btnGitHub.Size = new System.Drawing.Size(40, 40);
            this.btnGitHub.TabIndex = 201;
            this.btnGitHub.TabStop = false;
            this.toolTip.SetToolTip(this.btnGitHub, "Love CrapFixer? It’s open source — but your support keeps it alive! 💖");
            this.btnGitHub.UseVisualStyleBackColor = true;
            this.btnGitHub.Click += new System.EventHandler(this.btnGitHub_Click);
            //
            // lblOSInfo
            //
            this.lblOSInfo.AutoSize = true;
            this.lblOSInfo.BackColor = System.Drawing.Color.Transparent;
            this.lblOSInfo.Font = new System.Drawing.Font("Tahoma", 7.6F);
            this.lblOSInfo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
            this.lblOSInfo.Location = new System.Drawing.Point(90, 37);
            this.lblOSInfo.Name = "lblOSInfo";
            this.lblOSInfo.Size = new System.Drawing.Size(120, 13);
            this.lblOSInfo.TabIndex = 200;
            this.lblOSInfo.Text = "Checking your system..";
            //
            // lblVersionInfo
            //
            this.lblVersionInfo.AutoSize = true;
            this.lblVersionInfo.BackColor = System.Drawing.Color.Transparent;
            this.lblVersionInfo.Font = new System.Drawing.Font("Tahoma", 7.6F);
            this.lblVersionInfo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
            this.lblVersionInfo.Location = new System.Drawing.Point(198, 15);
            this.lblVersionInfo.Name = "lblVersionInfo";
            this.lblVersionInfo.Size = new System.Drawing.Size(13, 13);
            this.lblVersionInfo.TabIndex = 2;
            this.lblVersionInfo.Text = "v";
            //
            // lblHeader
            //
            this.lblHeader.AutoEllipsis = true;
            this.lblHeader.BackColor = System.Drawing.Color.Transparent;
            this.lblHeader.Cursor = System.Windows.Forms.Cursors.Hand;
            this.lblHeader.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold);
            this.lblHeader.ForeColor = System.Drawing.Color.White;
            this.lblHeader.Location = new System.Drawing.Point(89, 9);
            this.lblHeader.Name = "lblHeader";
            this.lblHeader.Size = new System.Drawing.Size(117, 25);
            this.lblHeader.TabIndex = 1;
            this.lblHeader.Text = "CrapFixer";
            this.toolTip.SetToolTip(this.lblHeader, "Click here to visit the CrapFixer website at github.com/builtbybel/crapfixer");
            this.lblHeader.UseCompatibleTextRendering = true;
            //
            // pictureHeader
            //
            this.pictureHeader.BackColor = System.Drawing.Color.Transparent;
            this.pictureHeader.Cursor = System.Windows.Forms.Cursors.Hand;
            this.pictureHeader.Image = global::CFixer.Properties.Resources.AppIcon;
            this.pictureHeader.InitialImage = null;
            this.pictureHeader.Location = new System.Drawing.Point(30, 9);
            this.pictureHeader.Name = "pictureHeader";
            this.pictureHeader.Size = new System.Drawing.Size(44, 41);
            this.pictureHeader.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            this.pictureHeader.TabIndex = 0;
            this.pictureHeader.TabStop = false;
            this.toolTip.SetToolTip(this.pictureHeader, "Click here to visit the CrapFixer website at github.com/builtbybel/crapfixer");
            //
            // btnRestore
            //
            this.btnRestore.AutoEllipsis = true;
            this.btnRestore.Cursor = System.Windows.Forms.Cursors.Default;
            this.btnRestore.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(170)))), ((int)(((byte)(210)))));
            this.btnRestore.FlatAppearance.BorderSize = 0;
            this.btnRestore.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnRestore.Font = new System.Drawing.Font("Tahoma", 8F);
            this.btnRestore.ForeColor = System.Drawing.Color.Gainsboro;
            this.btnRestore.Location = new System.Drawing.Point(10, 142);
            this.btnRestore.Name = "btnRestore";
            this.btnRestore.Size = new System.Drawing.Size(80, 60);
            this.btnRestore.TabIndex = 198;
            this.btnRestore.TabStop = false;
            this.btnRestore.Text = "&Restore";
            this.btnRestore.UseVisualStyleBackColor = true;
            this.btnRestore.Click += new System.EventHandler(this.btnRestore_Click);
            //
            // linkUpdateCheck
            //
            this.linkUpdateCheck.ActiveLinkColor = System.Drawing.Color.Blue;
            this.linkUpdateCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.linkUpdateCheck.AutoEllipsis = true;
            this.linkUpdateCheck.AutoSize = true;
            this.linkUpdateCheck.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.linkUpdateCheck.LinkColor = System.Drawing.Color.White;
            this.linkUpdateCheck.Location = new System.Drawing.Point(590, 447);
            this.linkUpdateCheck.Name = "linkUpdateCheck";
            this.linkUpdateCheck.Size = new System.Drawing.Size(107, 13);
            this.linkUpdateCheck.TabIndex = 203;
            this.linkUpdateCheck.TabStop = true;
            this.linkUpdateCheck.Text = "Check for updates...";
            this.linkUpdateCheck.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            this.linkUpdateCheck.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkUpdateCheck_LinkClicked);
            //
            // btnTools
            //
            this.btnTools.AutoEllipsis = true;
            this.btnTools.Cursor = System.Windows.Forms.Cursors.Default;
            this.btnTools.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(170)))), ((int)(((byte)(210)))));
            this.btnTools.FlatAppearance.BorderSize = 0;
            this.btnTools.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnTools.Font = new System.Drawing.Font("Tahoma", 8F);
            this.btnTools.ForeColor = System.Drawing.Color.Gainsboro;
            this.btnTools.Location = new System.Drawing.Point(10, 210);
            this.btnTools.Name = "btnTools";
            this.btnTools.Size = new System.Drawing.Size(80, 60);
            this.btnTools.TabIndex = 205;
            this.btnTools.TabStop = false;
            this.btnTools.Text = "&Tools";
            this.btnTools.UseVisualStyleBackColor = true;
            //
            // btnFixer
            //
            this.btnFixer.AutoEllipsis = true;
            this.btnFixer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(150)))), ((int)(((byte)(200)))), ((int)(((byte)(240)))));
            this.btnFixer.Cursor = System.Windows.Forms.Cursors.Default;
            this.btnFixer.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(170)))), ((int)(((byte)(210)))));
            this.btnFixer.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnFixer.Font = new System.Drawing.Font("Tahoma", 8F);
            this.btnFixer.ForeColor = System.Drawing.Color.Gainsboro;
            this.btnFixer.Location = new System.Drawing.Point(10, 74);
            this.btnFixer.Name = "btnFixer";
            this.btnFixer.Size = new System.Drawing.Size(80, 60);
            this.btnFixer.TabIndex = 206;
            this.btnFixer.TabStop = false;
            this.btnFixer.Text = "&Fixer";
            this.btnFixer.UseVisualStyleBackColor = false;
            //
            // linkSelection
            //
            this.linkSelection.ActiveLinkColor = System.Drawing.Color.Blue;
            this.linkSelection.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.linkSelection.AutoEllipsis = true;
            this.linkSelection.AutoSize = true;
            this.linkSelection.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.linkSelection.LinkColor = System.Drawing.Color.White;
            this.linkSelection.Location = new System.Drawing.Point(10, 447);
            this.linkSelection.Name = "linkSelection";
            this.linkSelection.Size = new System.Drawing.Size(49, 13);
            this.linkSelection.TabIndex = 207;
            this.linkSelection.TabStop = true;
            this.linkSelection.Text = "Select all";
            this.linkSelection.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            this.linkSelection.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkSelection_LinkClicked);
            //
            // MainForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
            this.AutoScroll = true;
            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(103)))), ((int)(((byte)(103)))), ((int)(((byte)(103)))));
            this.ClientSize = new System.Drawing.Size(710, 466);
            this.Controls.Add(this.linkSelection);
            this.Controls.Add(this.btnFixer);
            this.Controls.Add(this.btnTools);
            this.Controls.Add(this.panelHeader);
            this.Controls.Add(this.btnRestore);
            this.Controls.Add(this.linkUpdateCheck);
            this.Controls.Add(this.panelContainer);
            this.MinimumSize = new System.Drawing.Size(642, 337);
            this.Name = "MainForm";
            this.ShowIcon = false;
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "CrapFixer";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
            this.Shown += new System.EventHandler(this.MainForm_Shown);
            this.panelContainer.ResumeLayout(false);
            this.panelContent.ResumeLayout(false);
            this.tabControl.ResumeLayout(false);
            this.Windows.ResumeLayout(false);
            this.contextMenuStrip.ResumeLayout(false);
            this.Apps.ResumeLayout(false);
            this.groupBox.ResumeLayout(false);
            this.panelHeader.ResumeLayout(false);
            this.panelHeader.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureHeader)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion
        private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
        private System.Windows.Forms.ToolStripMenuItem fixMarkedFeatureToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem analyzeMarkedFeatureToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem restoreMarkedFeatureToolStripMenuItem;
        private System.Windows.Forms.Panel panelContainer;
        private System.Windows.Forms.TabControl tabControl;
        private System.Windows.Forms.TabPage Windows;
        private System.Windows.Forms.TabPage Apps;
        private System.Windows.Forms.GroupBox groupBox;
        public System.Windows.Forms.RichTextBox rtbLogger;
        private System.Windows.Forms.Button btnFix;
        private System.Windows.Forms.Panel panelHeader;
        private System.Windows.Forms.PictureBox pictureHeader;
        private System.Windows.Forms.Label lblVersionInfo;
        private System.Windows.Forms.Label lblHeader;
        private System.Windows.Forms.Button btnAnalyze;
        private System.Windows.Forms.Button btnRestore;
        private System.Windows.Forms.CheckedListBox checkedListBoxApps;
        private System.Windows.Forms.ToolStripSeparator seperatorToolStripMenuItem;
        private System.Windows.Forms.Panel panelContent;
        private System.Windows.Forms.LinkLabel linkUpdateCheck;
        private System.Windows.Forms.ToolStripMenuItem helpMarkedFeatureToolStripMenuItem;
        private System.Windows.Forms.Label lblOSInfo;
        private System.Windows.Forms.Button btnTools;
        private System.Windows.Forms.Button btnFixer;
        private System.Windows.Forms.LinkLabel linkSelection;
        private System.Windows.Forms.ComboBox comboLogActions;
        private System.Windows.Forms.TreeView treeFeatures;
        private System.Windows.Forms.Button btnGitHub;
        private System.Windows.Forms.ToolTip toolTip;
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Ads
{
    internal class LockScreenAds : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager";
        private const string valueName = "RotatingLockScreenOverlayEnabled";
        private const string valueName2 = "SubscribedContent-338387Enabled";
        private const int recommendedValue = 0;

        public override string ID() => "Disable Lock Screen Tips and Ads";

        public override string Info() => "This feature will disable tips and ads on the lock screen.";

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue) &&
                   Utils.IntEquals(keyName, valueName2, recommendedValue)
            );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);
                Registry.SetValue(keyName, valueName2, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);
                Registry.SetValue(keyName, valueName2, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Personalization
{
    internal class LockScreen : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization";
        private const string valueName = "NoLockScreen";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Don't use personalized lock screen";
        }

        public override string Info()
        {
            return "This feature will disable the personalized lock screen.";
        }

        public override Task<bool> CheckFeature()
        {
            bool result = !Utils.IntEquals(keyName, valueName, recommendedValue);
            return Task.FromResult(result);
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Privacy
{
    public class PrivacyExperience : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OOBE";
        private const string valueName = "DisablePrivacyExperience";
        private const int recommendedValue = 0;

        public override string ID() => "Disable Privacy Settings Experience at sign-in";

        public override string Info() => "This feature will disable Privacy Settings Experience at sign-in.";

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override Task<bool> CheckFeature()
        {
            bool result = !Utils.IntEquals(keyName, valueName, recommendedValue);
            return Task.FromResult(result);
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Ads
{
    internal class SettingsAds : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager";
        private const string valueName = "SubscribedContent-338393Enabled";
        private const string valueName2 = "SubscribedContent-353694Enabled";
        private const string valueName3 = "SubscribedContent-353696Enabled";

        private const int recommendedValue = 0;

        public override string ID() => "Disable Settings Ads";

        public override string Info() => "This feature will disable ads in settings.";

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} + {valueName2} + {valueName3} | Recommended Value: {recommendedValue}";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue) &&
                   Utils.IntEquals(keyName, valueName2, recommendedValue) &&
                   Utils.IntEquals(keyName, valueName3, recommendedValue)
            );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);
                Registry.SetValue(keyName, valueName2, 0, Microsoft.Win32.RegistryValueKind.DWord);
                Registry.SetValue(keyName, valueName3, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);
                Registry.SetValue(keyName, valueName2, 1, Microsoft.Win32.RegistryValueKind.DWord);
                Registry.SetValue(keyName, valueName3, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Personalization
{
    internal class AppDarkMode : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize";
        private const string valueName = "AppsUseLightTheme";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended: {recommendedValue} (Dark mode – preferred for a modern look, but up to you)";
        }

        public override string ID()
        {
            return "Enable Dark Mode for Apps";
        }

        public override string Info()
        {
            return "This feature enables Dark Mode for apps in Windows 11.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error in AppDarkMode: " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Error in AppDarkMode (Undo): " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }

    internal class SystemDarkMode : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize";
        private const string valueName = "SystemUsesLightTheme";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Suggestion: {recommendedValue} (Dark mode – easy on the eyes, but totally your call)";
        }

        public override string ID()
        {
            return "Enable Dark Mode for System";
        }

        public override string Info()
        {
            return "This feature enables Dark Mode for Windows system UI (e.g., taskbar, start menu).";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                Utils.RestartExplorer(); // Restart Explorer to apply changes
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error in SystemDarkMode: " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                Utils.RestartExplorer(); // Restart Explorer to apply changes
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Error in SystemDarkMode (Undo): " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Ads
{
    internal class TipsAndSuggestions : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager";
        private const string valueName = "SubscribedContent-338389Enabled";
        private const int recommendedValue = 0;

        public override string ID() => "Disable General Tips and Ads";

        public override string Info() => "This feature will disable general tips and ads.";

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue)
                 );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

namespace Views
{
    partial class AboutView
    {
        /// <summary>
        /// Erforderliche Designervariable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Vom Komponenten-Designer generierter Code

        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        private void InitializeComponent()
        {
            this.lblHeader = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.lblVersionInfo = new System.Windows.Forms.Label();
            this.linkGitHub = new System.Windows.Forms.LinkLabel();
            this.btnDonate = new System.Windows.Forms.Button();
            this.panelSettings = new System.Windows.Forms.Panel();
            this.comboBoxCurrency = new System.Windows.Forms.ComboBox();
            this.comboBoxAmount = new System.Windows.Forms.ComboBox();
            this.lblCopyright = new System.Windows.Forms.Label();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.panelSettings.SuspendLayout();
            this.SuspendLayout();
            //
            // lblHeader
            //
            this.lblHeader.AutoEllipsis = true;
            this.lblHeader.AutoSize = true;
            this.lblHeader.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Bold);
            this.lblHeader.ForeColor = System.Drawing.Color.Black;
            this.lblHeader.Location = new System.Drawing.Point(61, 19);
            this.lblHeader.Name = "lblHeader";
            this.lblHeader.Size = new System.Drawing.Size(71, 21);
            this.lblHeader.TabIndex = 235;
            this.lblHeader.Text = "CrapFixer";
            this.lblHeader.UseCompatibleTextRendering = true;
            //
            // label1
            //
            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.label1.AutoEllipsis = true;
            this.label1.Location = new System.Drawing.Point(15, 127);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(589, 26);
            this.label1.TabIndex = 236;
            this.label1.Text = "You can download the latest version, report bugs and submit feature requests at t" +
    "he following GitHub page.";
            //
            // pictureBox1
            //
            this.pictureBox1.Image = global::CFixer.Properties.Resources.AppIcon32;
            this.pictureBox1.Location = new System.Drawing.Point(18, 19);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(37, 34);
            this.pictureBox1.TabIndex = 237;
            this.pictureBox1.TabStop = false;
            //
            // lblVersionInfo
            //
            this.lblVersionInfo.AutoSize = true;
            this.lblVersionInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
            this.lblVersionInfo.ForeColor = System.Drawing.Color.Black;
            this.lblVersionInfo.Location = new System.Drawing.Point(61, 40);
            this.lblVersionInfo.Name = "lblVersionInfo";
            this.lblVersionInfo.Size = new System.Drawing.Size(13, 13);
            this.lblVersionInfo.TabIndex = 238;
            this.lblVersionInfo.Text = "v";
            //
            // linkGitHub
            //
            this.linkGitHub.AutoSize = true;
            this.linkGitHub.Location = new System.Drawing.Point(34, 162);
            this.linkGitHub.Name = "linkGitHub";
            this.linkGitHub.Size = new System.Drawing.Size(189, 13);
            this.linkGitHub.TabIndex = 239;
            this.linkGitHub.TabStop = true;
            this.linkGitHub.Text = "https://github.com/builtbybel/crapfixer";
            this.linkGitHub.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkGitHub_LinkClicked);
            //
            // btnDonate
            //
            this.btnDonate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(131)))), ((int)(((byte)(222)))));
            this.btnDonate.Cursor = System.Windows.Forms.Cursors.Hand;
            this.btnDonate.FlatAppearance.BorderSize = 0;
            this.btnDonate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnDonate.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btnDonate.ForeColor = System.Drawing.Color.White;
            this.btnDonate.Location = new System.Drawing.Point(226, 91);
            this.btnDonate.Name = "btnDonate";
            this.btnDonate.Size = new System.Drawing.Size(101, 22);
            this.btnDonate.TabIndex = 240;
            this.btnDonate.Text = "Donate";
            this.btnDonate.UseVisualStyleBackColor = false;
            this.btnDonate.Click += new System.EventHandler(this.btnDonate_Click);
            //
            // panelSettings
            //
            this.panelSettings.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
            this.panelSettings.Controls.Add(this.comboBoxCurrency);
            this.panelSettings.Controls.Add(this.comboBoxAmount);
            this.panelSettings.Controls.Add(this.lblCopyright);
            this.panelSettings.Controls.Add(this.btnDonate);
            this.panelSettings.Controls.Add(this.lblHeader);
            this.panelSettings.Controls.Add(this.linkGitHub);
            this.panelSettings.Controls.Add(this.label1);
            this.panelSettings.Controls.Add(this.lblVersionInfo);
            this.panelSettings.Controls.Add(this.pictureBox1);
            this.panelSettings.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panelSettings.Location = new System.Drawing.Point(0, 0);
            this.panelSettings.Name = "panelSettings";
            this.panelSettings.Size = new System.Drawing.Size(625, 395);
            this.panelSettings.TabIndex = 242;
            //
            // comboBoxCurrency
            //
            this.comboBoxCurrency.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxCurrency.Font = new System.Drawing.Font("Tahoma", 9.25F);
            this.comboBoxCurrency.FormattingEnabled = true;
            this.comboBoxCurrency.Location = new System.Drawing.Point(157, 91);
            this.comboBoxCurrency.Name = "comboBoxCurrency";
            this.comboBoxCurrency.Size = new System.Drawing.Size(63, 22);
            this.comboBoxCurrency.TabIndex = 243;
            //
            // comboBoxAmount
            //
            this.comboBoxAmount.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxAmount.Font = new System.Drawing.Font("Tahoma", 9.25F);
            this.comboBoxAmount.FormattingEnabled = true;
            this.comboBoxAmount.Location = new System.Drawing.Point(64, 91);
            this.comboBoxAmount.Name = "comboBoxAmount";
            this.comboBoxAmount.Size = new System.Drawing.Size(90, 22);
            this.comboBoxAmount.TabIndex = 242;
            //
            // lblCopyright
            //
            this.lblCopyright.AutoSize = true;
            this.lblCopyright.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
            this.lblCopyright.ForeColor = System.Drawing.Color.Black;
            this.lblCopyright.Location = new System.Drawing.Point(61, 58);
            this.lblCopyright.Name = "lblCopyright";
            this.lblCopyright.Size = new System.Drawing.Size(193, 13);
            this.lblCopyright.TabIndex = 241;
            this.lblCopyright.Text = "Copyright (c) 2025 A Belim app creation";
            //
            // AboutView
            //
            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.panelSettings);
            this.Name = "AboutView";
            this.Size = new System.Drawing.Size(625, 395);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.panelSettings.ResumeLayout(false);
            this.panelSettings.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion
        private System.Windows.Forms.Label lblHeader;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.PictureBox pictureBox1;
        private System.Windows.Forms.Label lblVersionInfo;
        private System.Windows.Forms.LinkLabel linkGitHub;
        private System.Windows.Forms.Button btnDonate;
        private System.Windows.Forms.Panel panelSettings;
        private System.Windows.Forms.Label lblCopyright;
        private System.Windows.Forms.ComboBox comboBoxAmount;
        private System.Windows.Forms.ComboBox comboBoxCurrency;
    }
}

using System;
using System.Windows.Forms;

/// <summary>
/// Manages log-related actions using a ComboBox in MainForm.
/// </summary>
public class LogActionsController
{
    private readonly ComboBox _combo;
    private readonly LogActions _logActions;

    public LogActionsController(ComboBox comboLogActions, LogActions logActions)
    {
        if (comboLogActions == null) throw new ArgumentNullException(nameof(comboLogActions));
        if (logActions == null) throw new ArgumentNullException(nameof(logActions));

        _combo = comboLogActions;
        _logActions = logActions;

        Initialize();
    }

    private void Initialize()
    {
        _combo.Items.Clear();
        _combo.Items.Add("Select an action...");
        _combo.Items.Add("Analyze log online (recommended)");
        _combo.Items.Add("Copy log to clipboard");
        _combo.Items.Add("Clear log");
        _combo.SelectedIndex = 0;

        _combo.SelectedIndexChanged += Combo_SelectedIndexChanged;
    }

    private void Combo_SelectedIndexChanged(object sender, EventArgs e)
    {
        string selected = _combo.SelectedItem as string;
        if (string.IsNullOrEmpty(selected))
        {
            Reset();
            return;
        }

        switch (selected)
        {
            case "Analyze log online (recommended)":
                _logActions.AnalyzeOnline("https://builtbybel.github.io/CrapFixer/log-analyzer/index.html");
                break;

            case "Copy log to clipboard":
                _logActions.CopyToClipboard();
                break;

            case "Clear log":
                _logActions.Clear();
                break;
        }

        Reset();
    }

    private void Reset()
    {
        // Reset the combo box to the default selection
        _combo.SelectedIndex = 0;
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Ads
{
    internal class FileExplorerAds : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced";
        private const string valueName = "ShowSyncProviderNotifications";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Disable File Explorer Ads";
        }

        public override string Info()
        {
            return "This feature will disable ads in File Explorer.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                Logger.Log("File Explorer Ads disabled", LogLevel.Info);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                Logger.Log("File Explorer Ads enabled", LogLevel.Info);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Personalization
{
    internal class TaskbarAlignment : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced";
        private const string valueName = "TaskbarAl";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Suggested Value: {recommendedValue} (Left – feels like home if you're coming from Windows 10)";
        }

        public override string ID()
        {
            return "Align Start button to left";
        }

        public override string Info()
        {
            return "This feature will align the Start button to left";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Personalization
{
    internal class ShowOrHideMostUsedApps : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer";
        private const string valueName = "ShowOrHideMostUsedApps";
        private const int recommendedValue = 2;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Hide Most used apps in start menu";
        }

        public override string Info()
        {
            return "This feature will hide Most used apps in start menu for all users";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Personalization
{
    internal class DisableSnapAssistFlyout : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced";
        private const string valueName = "EnableSnapAssistFlyout";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Disable Snap Assist Flyout";
        }

        public override string Info()
        {
            return "This feature disables the Snap Assist flyout, which appears when you snap a window.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error in DisableSnapAssistFlyout: " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Error in DisableSnapAssistFlyout (Undo): " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Personalization
{
    internal class Transparency : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize";
        private const string valueName = "EnableTransparency";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Suggestion: {recommendedValue} (No transparency – smoother performance, still stylish)";
        }

        public override string ID()
        {
            return "Disable Transparency Effects";
        }

        public override string Info()
        {
            return "This feature disables transparency effects for Start menu, taskbar, and other surfaces.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error in DisableTransparency: " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Error in DisableTransparency (Undo): " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Ads
{
    public class PersonalizedAds : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo";
        private const string valueName = "Enabled";
        private const int recommendedValue = 0;

        public override string ID() => "Disable Personalized Ads";

        public override string Info() => "This feature will disable personalized ads.";

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, 0));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Personalization
{
    internal class StartLayout : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced";
        private const string valueName = "Start_Layout";
        private const int recommendedValue = 1;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Pin more Apps on start menu";
        }

        public override string Info()
        {
            return "This feature will allow pinning more Apps on start menu";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Privacy
{
    public class Telemetry : FeatureBase
    {
        private const string dataCollection = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DataCollection";
        private const string diagTrack = @"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\DiagTrack";

        public override string ID() => "Turn off Telemetry data collection";

        public override string Info() => "This feature will turn off telemetry data collection and prevent the data from being sent to Microsoft.";

        public override string GetFeatureDetails()
        {
            return $"{dataCollection} | {diagTrack}";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
               Utils.IntEquals(dataCollection, "AllowTelemetry", 0) &&
                Utils.IntEquals(diagTrack, "Start", 4)

           );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(dataCollection, "AllowTelemetry", 0, RegistryValueKind.DWord);
                Registry.SetValue(diagTrack, "Start", 4, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(dataCollection, "AllowTelemetry", 1, RegistryValueKind.DWord);
                Registry.SetValue(diagTrack, "Start", 2, RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Ads
{
    internal class StartmenuAds : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced";
        private const string valueName = "Start_IrisRecommendations";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Disable Start menu Ads";
        }

        public override string Info()
        {
            return "This feature will disable ads in the start menu.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Privacy
{
    internal class ActivityHistory : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy";
        private const string valueName = "ActivityHistoryEnabled";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Disable activity history";
        }

        public override string Info()
        {
            return "Disable activity history (prevents Windows from tracking and storing your activity)";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
               Utils.IntEquals(keyName, valueName, recommendedValue)
         );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Ads
{
    public class WelcomeExperienceAds : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager";
        private const string valueName = "SubscribedContent-310093Enabled";
        private const int recommendedValue = 0;

        public override string ID() => "Disable Welcome Experience Ads";

        public override string Info() => "This feature will disable ads in the welcome experience.";

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, 0));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.System
{
    internal class TaskbarEndTask : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings";
        private const string valueName = "TaskbarEndTask";
        private const int recommendedValue = 1;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Enable End Task";
        }

        public override string Info()
        {
            return "Adds 'End Task' to the Windows 11 taskbar context menu, allowing you to directly kill unresponsive apps.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Failed to enable End Task: " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Failed to disable End Task: " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Ads
{
    internal class TailoredExperiences : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy";
        private const string valueName = "TailoredExperiencesWithDiagnosticDataEnabled";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Disable Tailored experiences";
        }

        public override string Info()
        {
            return "Tailored Experiences allows Microsoft to get information from you to deliver personalized tips, ads, and recommendations. Many people would call this telemetry, or even spying.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Ads
{
    internal class FinishSetupAds : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement";
        private const string valueName = "ScoobeSystemSettingEnabled";
        private const int recommendedValue = 0;

        public override string ID() => "Disable Finish Setup Ads";

        public override string Info() => "This feature will disable the \"Lets finish setting up your device\" and other advertising.";

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override Task<bool> CheckFeature()
        {
            return
                Task.FromResult(Utils.IntEquals(keyName, valueName, 0));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Personalization
{
    internal class ShowTaskViewButton : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced";
        private const string valueName = "ShowTaskViewButton";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended: {recommendedValue} (Task View off – cleaner taskbar, unless you use it often)";
        }

        public override string ID()
        {
            return "Hide Task view button on taskbar";
        }

        public override string Info()
        {
            return "This feature will hide the Task view button on taskbar";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Personalization
{
    internal class SearchboxTaskbarMode : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search";
        private const string valueName = "SearchboxTaskbarMode";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Hide search box on taskbar";
        }

        public override string Info()
        {
            return "This feature will hide search box on taskbar";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.IntEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 2, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using System;
using System.Diagnostics;
using System.Windows.Forms;

///
/// Provides actions for interacting with and managing the content of a log displayed in a <see cref="RichTextBox"/>.
///
/// <remarks>This class allows users to perform common operations on a log, such as copying its content to the
/// clipboard, analyzing it using the CrapFixer online analyzer tool, or clearing the log. It is designed to work with a <see
/// cref="RichTextBox"/> control that serves as the log display.</remarks>
public sealed class LogActions
{
    private readonly RichTextBox _logBox;

    public LogActions(RichTextBox logBox)
    {
        _logBox = logBox ?? throw new ArgumentNullException(nameof(logBox));
    }

    /// Copies the whole log to the clipboard.
    public void CopyToClipboard()
    {
        var text = _logBox.Text;
        if (!string.IsNullOrEmpty(text))
            Clipboard.SetText(text);
    }

    /// Opens CrapFixer online analyzer tool and passes the log via URL‑encoded GET parameter.
    public void AnalyzeOnline(string baseUrl)
    {
        if (string.IsNullOrWhiteSpace(baseUrl)) return;

        //  Get the current log text
        var logText = _logBox.Text;
        if (string.IsNullOrEmpty(logText)) return;

        // Copy the log to the cboard
        Clipboard.SetText(logText);

        Process.Start(baseUrl);

        MessageBox.Show(
            "The log has been copied to the clipboard.\n" +
            "Click “Paste log from clipboard” on the log analyzer page, or simply press CTRL+V,\n" +
            "to insert it into the analyzer.",
            "Log copied",
            MessageBoxButtons.OK,
            MessageBoxIcon.Information);
    }

    /// Clears the logger output.
    public void Clear()
        => _logBox.Clear();
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.System
{
    internal class BSODDetails : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\CrashControl";
        private const string valueName1 = "DisplayParameters";
        private const string valueName2 = "DisableEmoticon";
        private const int recommendedValue = 1;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Values: {valueName1}, {valueName2} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Show BSOD details instead of sad smiley";
        }

        public override string Info()
        {
            return "This method displays the full classic BSOD with technical error details instead of the simplified sad face version.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                Utils.IntEquals(keyName, valueName1, recommendedValue) &&
                Utils.IntEquals(keyName, valueName2, recommendedValue)
            );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName1, recommendedValue, RegistryValueKind.DWord);
                Registry.SetValue(keyName, valueName2, recommendedValue, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName1, 0, RegistryValueKind.DWord);
                Registry.SetValue(keyName, valueName2, 0, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Privacy
{
    internal class LocationTracking : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\LocationAndSensors";
        private const string valueName = "LocationEnabled";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Disable location tracking";
        }

        public override string Info()
        {
            return "Disable location tracking (prevents Windows from accessing your location)";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using System.Threading.Tasks;
using CrapFixer;

namespace Settings.UI
{
    internal class DisableBingSearch : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search";
        private const string valueName = "BingSearchEnabled";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Disable Bing Search";
        }

        public override string Info()
        {
            return "This feature disables Bing integration in Windows Search.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error in DisableBingSearch: " + ex.Message, LogLevel.Error);
                return Task.FromResult(false);
            }
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Error undoing DisableBingSearch: " + ex.Message, LogLevel.Error);
                return false;
            }
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Gaming
{
    internal class VisualFX : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects";
        private const string valueName = "VisualFXSetting";
        private const int recommendedValue = 2;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Disable Visual Effects";
        }

        public override string Info()
        {
            return "This feature will disable visual effects in Windows.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, 0));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 2, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using System;
using System.Drawing;
using System.Windows.Forms;

/// <summary>
/// A simple logger class to log messages to a RichTextBox.
/// </summary>
public static class Logger
{
    /// <summary>
    /// The RichTextBox control to which log messages are written.
    /// </summary>
    public static RichTextBox OutputBox;

    private static readonly Font DefaultFont = new Font("Tahoma", 8.25f, FontStyle.Regular);

    /// <summary>
    /// Writes a message with an optional log level and custom font.
    /// </summary>
    /// <param name="message">The message to display.</param>
    /// <param name="level">The log level (e.g., Info, Warning, Error).</param>
    /// <param name="customFont">An optional font for the message.</param>
    public static void Log(string message, LogLevel level = LogLevel.Info, Font customFont = null)
    {
        if (OutputBox == null) return;

        if (OutputBox.InvokeRequired)
        {
            OutputBox.Invoke(new Action(() => LogInternal(message, level, customFont)));
        }
        else
        {
            LogInternal(message, level, customFont);
        }
    }

    /// <summary>
    /// Internal method to append text to the RichTextBox with formatting.
    /// </summary>
    private static void LogInternal(string message, LogLevel level, Font customFont = null)
    {
        // string prefix = $"[{DateTime.Now:HH:mm:ss}] [{level}] ";
        string fullMessage = message + Environment.NewLine;

        // Set color based on log level
        Color color;
        switch (level)
        {
            case LogLevel.Warning:
                color = Color.OrangeRed;
                break;

            case LogLevel.Error:
                color = Color.Red;
                break;

            case LogLevel.Custom:
                color = Color.Magenta; // for plugins and other custom messages
                break;

            default:
                color = Color.Black;
                break;
        }

        // Append formatted message
        OutputBox.SelectionStart = OutputBox.TextLength;
        OutputBox.SelectionLength = 0;
        OutputBox.SelectionColor = color;
        OutputBox.SelectionFont = customFont ?? DefaultFont; // use custom font if provided, otherwise use default
        OutputBox.AppendText(fullMessage);

        // Reset selection to default
        OutputBox.SelectionColor = OutputBox.ForeColor; // reset color
        OutputBox.SelectionFont = DefaultFont; // reset font
        OutputBox.ScrollToCaret();   // scroll to the end
    }

    /// <summary>
    /// Clears the log output.
    /// </summary>
    public static void Clear()
    {
        if (OutputBox == null || OutputBox.IsDisposed)
            return;

        if (OutputBox.InvokeRequired)
        {
            OutputBox.Invoke(new Action(Clear));
            return;
        }

        OutputBox.Clear();
        OutputBox.SelectionColor = Color.Black;
    }
}

/// <summary>
/// Log level types used to define message severity.
/// </summary>
public enum LogLevel
{
    Info,
    Warning,
    Error,
    Custom
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Gaming
{
    internal class GameDVR : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\System\GameConfigStore";

        // 0 = Enabled, 2 = Disabled
        private const string keyName2 = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR";

        private const string valueName = "GameDVR_Enabled";
        private const string valueName2 = "GameDVR_FSEBehaviorMode";
        private const string valueName3 = "value";

        public override string GetFeatureDetails()
        {
            return $"{keyName} |Value: {valueName} | {valueName2} | {keyName2} | {valueName3} ";
        }

        public override string ID()
        {
            return "Disable Game DVR";
        }

        public override string Info()
        {
            return "This feature will disable Game DVR.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, 0) &&
                       Utils.IntEquals(keyName, valueName2, 2) &&
                       Utils.IntEquals(keyName2, valueName3, 0));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                Registry.SetValue(keyName, valueName2, 2, RegistryValueKind.DWord);
                Registry.SetValue(keyName2, valueName3, 0, RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
                Registry.SetValue(keyName, valueName2, 0, RegistryValueKind.DWord);
                Registry.SetValue(keyName2, valueName3, 1, RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Gaming
{
    internal class PowerThrottling : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling";
        private const string valueName = "PowerThrottlingOff";
        private const int recommendedValue = 1;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Disable Power Throttling";
        }

        public override string Info()
        {
            return "This feature will disable Power Throttling.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using System.Collections.Generic;
using System.Windows.Forms;

/// <summary>
/// Manages navigation between different views.
/// </summary>
public class NavigationManager
{
    private Stack<Control> navigationHistory = new Stack<Control>(); // Holds previous views
    private Panel panelContainer; // Reference to the panel container where views are switched
    private Control mainPanel; // Reference to the main panel (start page)

    public NavigationManager(Panel panel)
    {
        this.panelContainer = panel;
        this.mainPanel = panel.Controls.Count > 0 ? panel.Controls[0] : null;
    }

    /// <summary>
    /// Checks if there are views in the navigation history to go back to.
    /// </summary>
    public bool CanGoBack()
    {
        return navigationHistory.Count > 0;
    }

    /// <summary>
    /// Adds the current control to the navigation history.
    /// </summary>
    private void AddToHistory()
    {
        if (panelContainer.Controls.Count > 0)
        {
            // Add the currently visible control to the history stack
            navigationHistory.Push(panelContainer.Controls[0]);
        }
    }

    /// <summary>
    /// Switches to a new view and adds the current view to the navigation history.
    /// </summary>
    /// <param name="newView">The new view to display.</param>
    public void SwitchView(Control newView)
    {
        AddToHistory(); // Save the current view before switching

        // Clear the container and display the new view
        panelContainer.Controls.Clear();
        panelContainer.Controls.Add(newView);
        newView.Dock = DockStyle.Fill;
        newView.BringToFront();
    }

    /// <summary>
    /// Navigates back to the previous view in the history, if available.
    /// </summary>
    public void GoBack()
    {
        if (CanGoBack())
        {
            // Pop the last view from the history stack and display it
            Control previousView = navigationHistory.Pop();
            panelContainer.Controls.Clear();
            panelContainer.Controls.Add(previousView);
            previousView.Dock = DockStyle.Fill;
            previousView.BringToFront();
        }
    }

    /// <summary>
    /// Clears the navigation history.
    /// </summary>
    public void ClearHistory()
    {
        navigationHistory.Clear();
    }

    /// <summary>
    /// Switches directly to the main panel, clearing the navigation history.
    /// </summary>
    public void GoToMain()
    {
        if (mainPanel != null)
        {
            navigationHistory.Clear(); // Clear the navigation history
            panelContainer.Controls.Clear();
            panelContainer.Controls.Add(mainPanel);
            mainPanel.Dock = DockStyle.Fill;
            mainPanel.BringToFront();
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.AI
{
    internal class CopilotTaskbar : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\WindowsCopilot";
        private const string valueName = "TurnOffWindowsCopilot";
        private const int recommendedValue = 1;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Don't Show Copilot in Taskbar";
        }

        public override string Info()
        {
            return "This feature will disable Copilot in Taskbar.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, 1));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.System
{
    internal class SpeedUpShutdown : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control";
        private const string valueName = "WaitToKillServiceTimeout";
        private const string recommendedValue = "1000"; // Set to 1000 ms (1 second)

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue} ms";
        }

        public override string ID()
        {
            return "Speed Up Shutdown Time";
        }

        public override string Info()
        {
            return "This feature reduces the WaitToKillServiceTimeout value, which speeds up the shutdown process by reducing the time Windows waits for services to stop.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(
                   Utils.StringEquals(keyName, valueName, recommendedValue)
             );
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, RegistryValueKind.String);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error in SpeedUpShutdown: " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, "5000", RegistryValueKind.String); // Default value
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Error in SpeedUpShutdown (Undo): " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

//------------------------------------------------------------------------------
// <auto-generated>
//     Dieser Code wurde von einem Tool generiert.
//     Laufzeitversion:4.0.30319.42000
//
//     Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
//     der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------

namespace CFixer.Properties {
    using System;

    /// <summary>
    ///   Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
    /// </summary>
    // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
    // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
    // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
    // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }

        /// <summary>
        ///   Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CFixer.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
        ///   Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        /// <summary>
        ///   Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap AppIcon {
            get {
                object obj = ResourceManager.GetObject("AppIcon", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap AppIcon32 {
            get {
                object obj = ResourceManager.GetObject("AppIcon32", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Sucht eine lokalisierte Zeichenfolge, die Solitaire,CandyCrush,Netflix, Facebook,Twitter,Instagram,TikTok,Spotify, Skype,OneNote,OneDrive, Mail, Calendar, Weather,News,Maps, Groove, Movies,TV, Phone, Camera,Feedback,FeedbackHub, GetHelp,GetStarted,Messaging,Office,Paint3D,Print3D,StickyNotes,Wallet,YourPhone,3DViewer,Alarms,VoiceRecorder,ToDo,Whiteboard,ZuneMusic,ZuneVideo,3DViewer, DevHome, Copilot,MicrosoftPCManager ähnelt.
        /// </summary>
        internal static string PredefinedApps {
            get {
                return ResourceManager.GetString("PredefinedApps", resourceCulture);
            }
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class TabPageQuickLinks : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "NewTabPageQuickLinksEnabled";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Don't Show Quick links in new tab page";

        public override string Info() => "By default, when you open a new tab, you see a Bing search bar, Bing image of the day set as the page background. For supported websites, Quick Links on the New Tab page can display recent updates right in the tile";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class FirstRunExperience : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "HideFirstRunExperience";
        private const int recommendedValue = 1;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Don't Show First Run Experience";

        public override string Info() => "Hide home screen and 'Getting Started' on initial launch (from version 80 onwards)";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.UI
{
    internal class DisableSearchBoxSuggestions : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer";
        private const string valueName = "DisableSearchBoxSuggestions";
        private const int recommendedValue = 1;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID()
        {
            return "Disable Search Box Suggestions";
        }

        public override string Info()
        {
            return "This feature disables Bing search and web suggestions in the Windows Start Menu.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error in DisableSearchBoxSuggestions: " + ex.Message, LogLevel.Error);
                return Task.FromResult(false);
            }
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord); // 0 = Enable suggestions
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Error undoing DisableSearchBoxSuggestions: " + ex.Message, LogLevel.Error);
                return false;
            }
        }
    }
}

using Microsoft.Win32;
using System;
using System.Threading.Tasks;
using CrapFixer;

namespace Settings.UI
{
    /// <summary>
    /// Disables the Click to Do feature, which also removes its entry from the right-click context menu.
    /// Only available on Copilot+ PCs running Windows 11 24H2 or newer.
    /// Requires a PC with an NPU (Neural Processing Unit).
    /// </summary>
    internal class ClickToDo: FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\ClickToDo";
        private const string valueName = "DisableClickToDo";
        private const int recommendedValue = 1; // 1 = fully disabled, including context menu

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Set to: {recommendedValue} (disables Click to Do, removing it from context menus). " +
                   "Note: This setting only applies on Copilot+ PCs with Windows 11 24H2 or newer.";
        }

        public override string ID()
        {
            return "Disable Click to Do (Only Copilot+ PCs)";
        }

        public override string Info()
        {
            return "Disables Click to Do entirely, including its context menu entry which uses on-device AI to suggest actions based on screen content. Only available on Copilot+ PCs with Windows 11 24H2 or newer.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, RegistryValueKind.DWord);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error disabling Click to Do: " + ex.Message, LogLevel.Error);
                return Task.FromResult(false);
            }
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Error re-enabling Click to Do: " + ex.Message, LogLevel.Error);
                return false;
            }
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class DefautBrowserSetting : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "DefaultBrowserSettingEnabled";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Disable Microsoft Edge as default browser";

        public override string Info() => "Force Edge to stop asking to change default browser";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class EdgeShoppingAssistant : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "EdgeShoppingAssistantEnabled";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Disable Shopping assistant";

        public override string Info() => "Shopping in Microsoft Edge feature will automatically find you the best prices and coupons from across the web as you shop";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class StartupBoost : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "StartupBoostEnabled";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Disable Start Boost";

        public override string Info() => "Enables Microsoft Edge processes to initialize at operating system startup and restart in the background after the last browser window has been closed";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class GamerMode : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "GamerModeEnabled";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Disable Gamer Mode";

        public override string Info() => "Microsoft Edge Gamer Mode allows gamers to personalize their browser with gaming themes and gives them the option of enabling Efficiency Mode for PC gaming, the Gaming feed on new tabs, sidebar apps for gamers, and more";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class UserFeedback : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "UserFeedbackAllowed";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Don't Submit user feedback option";

        public override string Info() => "Allow the submission of feedback, suggestions, or customer surveys, as well as reporting issues with the browser";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class ImportOnEachLaunch : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "ImportOnEachLaunch";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Don't Allow to Import of data from other browsers on each launch";

        public override string Info() => "Allow import of data from other browsers on each Microsoft Edge launch";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class DefaultTopSites : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "NewTabPageHideDefaultTopSites";
        private const int recommendedValue = 1;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Don't Show Sponsored links in new tab page";

        public override string Info() => "Hide default top sites from the new tab page in Microsoft Edge";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class BrowserSignin : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "BrowserSignin";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Disable Browser sign in and sync services";

        public override string Info() => "This setting controls whether a user can sign into Microsoft Edge with an account to use services such as sync and single sign on";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class EdgeCollections : FeatureBase
    {
        private const string keyName = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge";
        private const string valueName = "EdgeCollectionsEnabled";
        private const int recommendedValue = 0;

        public override string ID() => "Disable Access to Collections feature";

        public override string Info() => "Enables users to access the Collections feature, allowing them to gather, organize, share, and export content more efficiently with Office integration";

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.System
{
    internal class MenuShowDelay : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Control Panel\Desktop";
        private const string valueName = "MenuShowDelay";
        private const string recommendedValue = "10";

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: \"{recommendedValue}\" (faster menu response)";
        }

        public override string ID()
        {
            return "Speed Up Menu Show Delay";
        }

        public override string Info()
        {
            return "Speeds up the appearance of menus and submenus by lowering the default delay. This improves the perceived responsiveness of the UI.";
        }

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.StringEquals(keyName, valueName, recommendedValue));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, recommendedValue, RegistryValueKind.String);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, "400", RegistryValueKind.String); // Default is 400 on Windows 11
                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

namespace CFixer.Views
{
    partial class PluginsView
    {
        /// <summary>
        /// Erforderliche Designervariable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Vom Komponenten-Designer generierter Code

        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        private void InitializeComponent()
        {
            this.btnPluginInstall = new System.Windows.Forms.Button();
            this.btnDescription = new System.Windows.Forms.Button();
            this.progressBarDownload = new System.Windows.Forms.ProgressBar();
            this.btnPluginEdit = new System.Windows.Forms.Button();
            this.btnPluginRemove = new System.Windows.Forms.Button();
            this.btnPluginSubmit = new System.Windows.Forms.Button();
            this.btnPluginUpdateAll = new System.Windows.Forms.Button();
            this.btnHelp = new System.Windows.Forms.Button();
            this.textSearch = new System.Windows.Forms.TextBox();
            this.linkPluginUsage = new System.Windows.Forms.LinkLabel();
            this.listPlugins = new System.Windows.Forms.ListView();
            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.SuspendLayout();
            //
            // btnPluginInstall
            //
            this.btnPluginInstall.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnPluginInstall.Location = new System.Drawing.Point(500, 46);
            this.btnPluginInstall.Name = "btnPluginInstall";
            this.btnPluginInstall.Size = new System.Drawing.Size(109, 29);
            this.btnPluginInstall.TabIndex = 7;
            this.btnPluginInstall.Text = "Install";
            this.btnPluginInstall.UseVisualStyleBackColor = true;
            this.btnPluginInstall.Click += new System.EventHandler(this.btnPluginInstall_Click);
            //
            // btnDescription
            //
            this.btnDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.btnDescription.AutoEllipsis = true;
            this.btnDescription.BackColor = System.Drawing.Color.WhiteSmoke;
            this.btnDescription.FlatAppearance.BorderColor = System.Drawing.Color.Gainsboro;
            this.btnDescription.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnDescription.Location = new System.Drawing.Point(15, 10);
            this.btnDescription.Name = "btnDescription";
            this.btnDescription.Padding = new System.Windows.Forms.Padding(20, 0, 100, 0);
            this.btnDescription.Size = new System.Drawing.Size(594, 25);
            this.btnDescription.TabIndex = 6;
            this.btnDescription.Text = "Plugins Gallery (App restart needed after install)";
            this.btnDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btnDescription.UseVisualStyleBackColor = true;
            //
            // progressBarDownload
            //
            this.progressBarDownload.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.progressBarDownload.Location = new System.Drawing.Point(15, 380);
            this.progressBarDownload.Name = "progressBarDownload";
            this.progressBarDownload.Size = new System.Drawing.Size(470, 12);
            this.progressBarDownload.TabIndex = 9;
            this.progressBarDownload.Visible = false;
            //
            // btnPluginEdit
            //
            this.btnPluginEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnPluginEdit.Location = new System.Drawing.Point(500, 151);
            this.btnPluginEdit.Name = "btnPluginEdit";
            this.btnPluginEdit.Size = new System.Drawing.Size(109, 29);
            this.btnPluginEdit.TabIndex = 10;
            this.btnPluginEdit.Text = "Edit";
            this.btnPluginEdit.UseVisualStyleBackColor = true;
            this.btnPluginEdit.Click += new System.EventHandler(this.btnPluginEdit_Click);
            //
            // btnPluginRemove
            //
            this.btnPluginRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnPluginRemove.Location = new System.Drawing.Point(500, 116);
            this.btnPluginRemove.Name = "btnPluginRemove";
            this.btnPluginRemove.Size = new System.Drawing.Size(109, 29);
            this.btnPluginRemove.TabIndex = 11;
            this.btnPluginRemove.Text = "Remove";
            this.btnPluginRemove.UseVisualStyleBackColor = true;
            this.btnPluginRemove.Click += new System.EventHandler(this.btnPluginRemove_Click);
            //
            // btnPluginSubmit
            //
            this.btnPluginSubmit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.btnPluginSubmit.Location = new System.Drawing.Point(500, 345);
            this.btnPluginSubmit.Name = "btnPluginSubmit";
            this.btnPluginSubmit.Size = new System.Drawing.Size(109, 29);
            this.btnPluginSubmit.TabIndex = 12;
            this.btnPluginSubmit.Text = "Submit Plugin";
            this.btnPluginSubmit.UseVisualStyleBackColor = true;
            this.btnPluginSubmit.Click += new System.EventHandler(this.btnPluginSubmit_Click);
            //
            // btnPluginUpdateAll
            //
            this.btnPluginUpdateAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnPluginUpdateAll.Location = new System.Drawing.Point(500, 81);
            this.btnPluginUpdateAll.Name = "btnPluginUpdateAll";
            this.btnPluginUpdateAll.Size = new System.Drawing.Size(109, 29);
            this.btnPluginUpdateAll.TabIndex = 13;
            this.btnPluginUpdateAll.Text = "Update All";
            this.btnPluginUpdateAll.UseVisualStyleBackColor = true;
            this.btnPluginUpdateAll.Click += new System.EventHandler(this.btnPluginUpdateAll_Click);
            //
            // btnHelp
            //
            this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnHelp.Location = new System.Drawing.Point(500, 186);
            this.btnHelp.Name = "btnHelp";
            this.btnHelp.Size = new System.Drawing.Size(109, 29);
            this.btnHelp.TabIndex = 14;
            this.btnHelp.Text = "Help";
            this.btnHelp.UseVisualStyleBackColor = true;
            this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
            //
            // textSearch
            //
            this.textSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.textSearch.Location = new System.Drawing.Point(500, 233);
            this.textSearch.Name = "textSearch";
            this.textSearch.Size = new System.Drawing.Size(109, 20);
            this.textSearch.TabIndex = 245;
            this.textSearch.Text = "Search";
            this.textSearch.Click += new System.EventHandler(this.textSearch_Click);
            this.textSearch.TextChanged += new System.EventHandler(this.textSearch_TextChanged);
            //
            // linkPluginUsage
            //
            this.linkPluginUsage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.linkPluginUsage.AutoSize = true;
            this.linkPluginUsage.BackColor = System.Drawing.Color.WhiteSmoke;
            this.linkPluginUsage.Location = new System.Drawing.Point(535, 16);
            this.linkPluginUsage.Name = "linkPluginUsage";
            this.linkPluginUsage.Size = new System.Drawing.Size(67, 13);
            this.linkPluginUsage.TabIndex = 246;
            this.linkPluginUsage.TabStop = true;
            this.linkPluginUsage.Text = "Usage notes";
            this.linkPluginUsage.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkPluginUsage_LinkClicked);
            //
            // listPlugins
            //
            this.listPlugins.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.listPlugins.CheckBoxes = true;
            this.listPlugins.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1,
            this.columnHeader2,
            this.columnHeader3});
            this.listPlugins.FullRowSelect = true;
            this.listPlugins.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
            this.listPlugins.HideSelection = false;
            this.listPlugins.Location = new System.Drawing.Point(15, 46);
            this.listPlugins.Name = "listPlugins";
            this.listPlugins.Size = new System.Drawing.Size(470, 328);
            this.listPlugins.TabIndex = 247;
            this.listPlugins.UseCompatibleStateImageBehavior = false;
            this.listPlugins.View = System.Windows.Forms.View.Details;
            this.listPlugins.SelectedIndexChanged += new System.EventHandler(this.listPlugins_SelectedIndexChanged);
            //
            // columnHeader1
            //
            this.columnHeader1.Text = "Plugin";
            //
            // columnHeader2
            //
            this.columnHeader2.Text = "Installed";
            //
            // columnHeader3
            //
            this.columnHeader3.Text = "Type";
            this.columnHeader3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            //
            // PluginsView
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
            this.AutoScroll = true;
            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
            this.Controls.Add(this.listPlugins);
            this.Controls.Add(this.linkPluginUsage);
            this.Controls.Add(this.textSearch);
            this.Controls.Add(this.btnHelp);
            this.Controls.Add(this.btnPluginUpdateAll);
            this.Controls.Add(this.btnPluginSubmit);
            this.Controls.Add(this.btnPluginRemove);
            this.Controls.Add(this.btnPluginEdit);
            this.Controls.Add(this.progressBarDownload);
            this.Controls.Add(this.btnPluginInstall);
            this.Controls.Add(this.btnDescription);
            this.Name = "PluginsView";
            this.Size = new System.Drawing.Size(625, 395);
            this.Load += new System.EventHandler(this.PluginsView_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button btnPluginInstall;
        private System.Windows.Forms.Button btnDescription;
        private System.Windows.Forms.ProgressBar progressBarDownload;
        private System.Windows.Forms.Button btnPluginEdit;
        private System.Windows.Forms.Button btnPluginRemove;
        private System.Windows.Forms.Button btnPluginSubmit;
        private System.Windows.Forms.Button btnPluginUpdateAll;
        private System.Windows.Forms.Button btnHelp;
        private System.Windows.Forms.TextBox textSearch;
        private System.Windows.Forms.LinkLabel linkPluginUsage;
        private System.Windows.Forms.ListView listPlugins;
        private System.Windows.Forms.ColumnHeader columnHeader1;
        private System.Windows.Forms.ColumnHeader columnHeader2;
        private System.Windows.Forms.ColumnHeader columnHeader3;
    }
}

namespace CFixer.Views
{
    partial class ViveView
    {
        /// <summary>
        /// Erforderliche Designervariable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Vom Komponenten-Designer generierter Code

        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        private void InitializeComponent()
        {
            this.dataGridView = new System.Windows.Forms.DataGridView();
            this.EnabledColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
            this.NameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.IdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.StatusColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.InfoColumn = new System.Windows.Forms.DataGridViewLinkColumn();
            this.btnApply = new System.Windows.Forms.Button();
            this.btnDescription = new System.Windows.Forms.Button();
            this.linkPluginUsage = new System.Windows.Forms.LinkLabel();
            this.txtCustomIds = new System.Windows.Forms.TextBox();
            this.lblCustomIds = new System.Windows.Forms.Label();
            this.btnApplyCustom = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
            this.SuspendLayout();
            //
            // dataGridView
            //
            this.dataGridView.AllowUserToAddRows = false;
            this.dataGridView.AllowUserToDeleteRows = false;
            this.dataGridView.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.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dataGridView.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
            this.dataGridView.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.dataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
            this.dataGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
            this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.EnabledColumn,
            this.NameColumn,
            this.IdColumn,
            this.StatusColumn,
            this.InfoColumn});
            this.dataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
            this.dataGridView.Location = new System.Drawing.Point(15, 46);
            this.dataGridView.Name = "dataGridView";
            this.dataGridView.RowHeadersVisible = false;
            this.dataGridView.Size = new System.Drawing.Size(470, 305);
            this.dataGridView.TabIndex = 0;
            this.dataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellContentClick);
            //
            // EnabledColumn
            //
            this.EnabledColumn.FillWeight = 57.38248F;
            this.EnabledColumn.HeaderText = "";
            this.EnabledColumn.Name = "EnabledColumn";
            this.EnabledColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.EnabledColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            //
            // NameColumn
            //
            this.NameColumn.FillWeight = 203.0457F;
            this.NameColumn.HeaderText = "Feature";
            this.NameColumn.Name = "NameColumn";
            //
            // IdColumn
            //
            this.IdColumn.FillWeight = 79.85728F;
            this.IdColumn.HeaderText = "ID";
            this.IdColumn.Name = "IdColumn";
            //
            // StatusColumn
            //
            this.StatusColumn.FillWeight = 79.85728F;
            this.StatusColumn.HeaderText = "Status";
            this.StatusColumn.Name = "StatusColumn";
            this.StatusColumn.ReadOnly = true;
            //
            // InfoColumn
            //
            this.InfoColumn.FillWeight = 79.85728F;
            this.InfoColumn.HeaderText = "Info";
            this.InfoColumn.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
            this.InfoColumn.Name = "InfoColumn";
            this.InfoColumn.ReadOnly = true;
            this.InfoColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.InfoColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            //
            // btnApply
            //
            this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnApply.Location = new System.Drawing.Point(500, 47);
            this.btnApply.Name = "btnApply";
            this.btnApply.Size = new System.Drawing.Size(109, 29);
            this.btnApply.TabIndex = 8;
            this.btnApply.Text = "Apply selected";
            this.btnApply.UseVisualStyleBackColor = true;
            this.btnApply.Click += new System.EventHandler(this.btnViveApply_Click);
            //
            // btnDescription
            //
            this.btnDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.btnDescription.AutoEllipsis = true;
            this.btnDescription.BackColor = System.Drawing.Color.WhiteSmoke;
            this.btnDescription.FlatAppearance.BorderColor = System.Drawing.Color.Gainsboro;
            this.btnDescription.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnDescription.Location = new System.Drawing.Point(15, 10);
            this.btnDescription.Name = "btnDescription";
            this.btnDescription.Padding = new System.Windows.Forms.Padding(20, 0, 100, 0);
            this.btnDescription.Size = new System.Drawing.Size(594, 25);
            this.btnDescription.TabIndex = 9;
            this.btnDescription.Text = "ViVe Tool";
            this.btnDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btnDescription.UseVisualStyleBackColor = true;
            //
            // linkPluginUsage
            //
            this.linkPluginUsage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.linkPluginUsage.AutoSize = true;
            this.linkPluginUsage.BackColor = System.Drawing.Color.WhiteSmoke;
            this.linkPluginUsage.Location = new System.Drawing.Point(535, 16);
            this.linkPluginUsage.Name = "linkPluginUsage";
            this.linkPluginUsage.Size = new System.Drawing.Size(56, 13);
            this.linkPluginUsage.TabIndex = 247;
            this.linkPluginUsage.TabStop = true;
            this.linkPluginUsage.Text = "More infos";
            this.linkPluginUsage.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkPluginUsage_LinkClicked);
            //
            // txtCustomIds
            //
            this.txtCustomIds.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtCustomIds.Location = new System.Drawing.Point(77, 357);
            this.txtCustomIds.Multiline = true;
            this.txtCustomIds.Name = "txtCustomIds";
            this.txtCustomIds.Size = new System.Drawing.Size(408, 24);
            this.txtCustomIds.TabIndex = 248;
            //
            // lblCustomIds
            //
            this.lblCustomIds.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.lblCustomIds.AutoSize = true;
            this.lblCustomIds.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblCustomIds.Location = new System.Drawing.Point(12, 363);
            this.lblCustomIds.Name = "lblCustomIds";
            this.lblCustomIds.Size = new System.Drawing.Size(59, 13);
            this.lblCustomIds.TabIndex = 249;
            this.lblCustomIds.Text = "Custom Ids";
            //
            // btnApplyCustom
            //
            this.btnApplyCustom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.btnApplyCustom.Location = new System.Drawing.Point(500, 355);
            this.btnApplyCustom.Name = "btnApplyCustom";
            this.btnApplyCustom.Size = new System.Drawing.Size(109, 29);
            this.btnApplyCustom.TabIndex = 250;
            this.btnApplyCustom.Text = "Apply Custom";
            this.btnApplyCustom.UseVisualStyleBackColor = true;
            this.btnApplyCustom.Click += new System.EventHandler(this.btnApplyCustom_Click);
            //
            // ViveView
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
            this.Controls.Add(this.btnApplyCustom);
            this.Controls.Add(this.lblCustomIds);
            this.Controls.Add(this.txtCustomIds);
            this.Controls.Add(this.linkPluginUsage);
            this.Controls.Add(this.btnDescription);
            this.Controls.Add(this.btnApply);
            this.Controls.Add(this.dataGridView);
            this.Name = "ViveView";
            this.Size = new System.Drawing.Size(625, 395);
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.DataGridView dataGridView;
        private System.Windows.Forms.Button btnApply;
        private System.Windows.Forms.Button btnDescription;
        private System.Windows.Forms.LinkLabel linkPluginUsage;
        private System.Windows.Forms.TextBox txtCustomIds;
        private System.Windows.Forms.Label lblCustomIds;
        private System.Windows.Forms.Button btnApplyCustom;
        private System.Windows.Forms.DataGridViewCheckBoxColumn EnabledColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn NameColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn IdColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn StatusColumn;
        private System.Windows.Forms.DataGridViewLinkColumn InfoColumn;
    }
}

namespace CFixer.Views
{
    partial class OptionsView
    {
        /// <summary>
        /// Erforderliche Designervariable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Vom Komponenten-Designer generierter Code

        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        private void InitializeComponent()
        {
            this.panelSettings = new System.Windows.Forms.Panel();
            this.btnViveMenu = new System.Windows.Forms.Button();
            this.btnPluginsMenu = new System.Windows.Forms.Button();
            this.panelSubContent = new System.Windows.Forms.Panel();
            this.btnAboutMenu = new System.Windows.Forms.Button();
            this.btnSettingsMenu = new System.Windows.Forms.Button();
            this.panelSettings.SuspendLayout();
            this.SuspendLayout();
            //
            // panelSettings
            //
            this.panelSettings.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(248)))), ((int)(((byte)(248)))));
            this.panelSettings.Controls.Add(this.btnViveMenu);
            this.panelSettings.Controls.Add(this.btnPluginsMenu);
            this.panelSettings.Controls.Add(this.panelSubContent);
            this.panelSettings.Controls.Add(this.btnAboutMenu);
            this.panelSettings.Controls.Add(this.btnSettingsMenu);
            this.panelSettings.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panelSettings.Location = new System.Drawing.Point(0, 0);
            this.panelSettings.Name = "panelSettings";
            this.panelSettings.Size = new System.Drawing.Size(625, 395);
            this.panelSettings.TabIndex = 243;
            //
            // btnViveMenu
            //
            this.btnViveMenu.BackColor = System.Drawing.Color.White;
            this.btnViveMenu.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
            this.btnViveMenu.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(193)))), ((int)(((byte)(210)))), ((int)(((byte)(238)))));
            this.btnViveMenu.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnViveMenu.Font = new System.Drawing.Font("Tahoma", 8F);
            this.btnViveMenu.Location = new System.Drawing.Point(14, 88);
            this.btnViveMenu.Name = "btnViveMenu";
            this.btnViveMenu.Size = new System.Drawing.Size(100, 32);
            this.btnViveMenu.TabIndex = 248;
            this.btnViveMenu.Text = "Features ";
            this.btnViveMenu.UseVisualStyleBackColor = false;
            this.btnViveMenu.Click += new System.EventHandler(this.btnViveMenu_Click);
            //
            // btnPluginsMenu
            //
            this.btnPluginsMenu.BackColor = System.Drawing.Color.White;
            this.btnPluginsMenu.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
            this.btnPluginsMenu.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(193)))), ((int)(((byte)(210)))), ((int)(((byte)(238)))));
            this.btnPluginsMenu.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnPluginsMenu.Font = new System.Drawing.Font("Tahoma", 8F);
            this.btnPluginsMenu.Location = new System.Drawing.Point(14, 48);
            this.btnPluginsMenu.Name = "btnPluginsMenu";
            this.btnPluginsMenu.Size = new System.Drawing.Size(100, 32);
            this.btnPluginsMenu.TabIndex = 247;
            this.btnPluginsMenu.Text = "Plugins";
            this.btnPluginsMenu.UseVisualStyleBackColor = false;
            this.btnPluginsMenu.Click += new System.EventHandler(this.btnPluginsMenu_Click);
            //
            // panelSubContent
            //
            this.panelSubContent.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.panelSubContent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
            this.panelSubContent.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panelSubContent.Location = new System.Drawing.Point(129, 8);
            this.panelSubContent.Name = "panelSubContent";
            this.panelSubContent.Size = new System.Drawing.Size(487, 378);
            this.panelSubContent.TabIndex = 246;
            //
            // btnAboutMenu
            //
            this.btnAboutMenu.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.btnAboutMenu.BackColor = System.Drawing.Color.White;
            this.btnAboutMenu.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
            this.btnAboutMenu.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(193)))), ((int)(((byte)(210)))), ((int)(((byte)(238)))));
            this.btnAboutMenu.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnAboutMenu.Font = new System.Drawing.Font("Tahoma", 8F);
            this.btnAboutMenu.Location = new System.Drawing.Point(14, 354);
            this.btnAboutMenu.Name = "btnAboutMenu";
            this.btnAboutMenu.Size = new System.Drawing.Size(100, 32);
            this.btnAboutMenu.TabIndex = 242;
            this.btnAboutMenu.Text = "About";
            this.btnAboutMenu.UseVisualStyleBackColor = false;
            this.btnAboutMenu.Click += new System.EventHandler(this.btnAboutMenu_Click);
            //
            // btnSettingsMenu
            //
            this.btnSettingsMenu.BackColor = System.Drawing.Color.White;
            this.btnSettingsMenu.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
            this.btnSettingsMenu.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(193)))), ((int)(((byte)(210)))), ((int)(((byte)(238)))));
            this.btnSettingsMenu.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnSettingsMenu.Font = new System.Drawing.Font("Tahoma", 8F);
            this.btnSettingsMenu.Location = new System.Drawing.Point(14, 8);
            this.btnSettingsMenu.Name = "btnSettingsMenu";
            this.btnSettingsMenu.Size = new System.Drawing.Size(100, 32);
            this.btnSettingsMenu.TabIndex = 241;
            this.btnSettingsMenu.Text = "Settings";
            this.btnSettingsMenu.UseVisualStyleBackColor = false;
            this.btnSettingsMenu.Click += new System.EventHandler(this.btnSettingsMenu_Click);
            //
            // OptionsView
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.panelSettings);
            this.Name = "OptionsView";
            this.Size = new System.Drawing.Size(625, 395);
            this.panelSettings.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Panel panelSettings;
        private System.Windows.Forms.Button btnSettingsMenu;
        private System.Windows.Forms.Button btnAboutMenu;
        private System.Windows.Forms.Panel panelSubContent;
        private System.Windows.Forms.Button btnPluginsMenu;
        private System.Windows.Forms.Button btnViveMenu;
    }
}

namespace CFixer.Views
{
    partial class SettingsView
    {
        /// <summary>
        /// Erforderliche Designervariable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Vom Komponenten-Designer generierter Code

        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        private void InitializeComponent()
        {
            this.checkSaveToINI = new System.Windows.Forms.CheckBox();
            this.checkBox2 = new System.Windows.Forms.CheckBox();
            this.button1 = new System.Windows.Forms.Button();
            this.checkInstallIcons = new System.Windows.Forms.CheckBox();
            this.SuspendLayout();
            //
            // checkSaveToINI
            //
            this.checkSaveToINI.AutoSize = true;
            this.checkSaveToINI.Location = new System.Drawing.Point(15, 48);
            this.checkSaveToINI.Name = "checkSaveToINI";
            this.checkSaveToINI.Size = new System.Drawing.Size(148, 17);
            this.checkSaveToINI.TabIndex = 0;
            this.checkSaveToINI.Text = "Save all settings to INI file";
            this.checkSaveToINI.UseVisualStyleBackColor = true;
            //
            // checkBox2
            //
            this.checkBox2.Checked = true;
            this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox2.Enabled = false;
            this.checkBox2.Location = new System.Drawing.Point(15, 71);
            this.checkBox2.Name = "checkBox2";
            this.checkBox2.Size = new System.Drawing.Size(236, 35);
            this.checkBox2.TabIndex = 1;
            this.checkBox2.Text = "Activate Plugins for PowerShell Tooling (Super Plugins)";
            this.checkBox2.UseVisualStyleBackColor = true;
            //
            // button1
            //
            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.button1.BackColor = System.Drawing.Color.WhiteSmoke;
            this.button1.FlatAppearance.BorderColor = System.Drawing.Color.Gainsboro;
            this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button1.Location = new System.Drawing.Point(15, 10);
            this.button1.Name = "button1";
            this.button1.Padding = new System.Windows.Forms.Padding(20, 0, 0, 0);
            this.button1.Size = new System.Drawing.Size(594, 25);
            this.button1.TabIndex = 2;
            this.button1.Text = "Basic settings";
            this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.button1.UseVisualStyleBackColor = false;
            //
            // checkInstallIcons
            //
            this.checkInstallIcons.AutoSize = true;
            this.checkInstallIcons.Location = new System.Drawing.Point(15, 112);
            this.checkInstallIcons.Name = "checkInstallIcons";
            this.checkInstallIcons.Size = new System.Drawing.Size(265, 17);
            this.checkInstallIcons.TabIndex = 4;
            this.checkInstallIcons.Text = "Download optional icons to enhance navigation UI";
            this.checkInstallIcons.UseVisualStyleBackColor = true;
            this.checkInstallIcons.CheckedChanged += new System.EventHandler(this.checkInstallIcons_CheckedChanged);
            //
            // SettingsView
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
            this.Controls.Add(this.checkInstallIcons);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.checkBox2);
            this.Controls.Add(this.checkSaveToINI);
            this.Name = "SettingsView";
            this.Size = new System.Drawing.Size(625, 395);
            this.Leave += new System.EventHandler(this.SettingsView_Leave);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.CheckBox checkSaveToINI;
        private System.Windows.Forms.CheckBox checkBox2;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.CheckBox checkInstallIcons;
    }
}

using Microsoft.Win32;
using System;
using CrapFixer;
using System.Threading.Tasks;

namespace Settings.Edge
{
    public class HubsSidebar : FeatureBase
    {
        private const string keyName = @"HKEY_CURRENT_USER\Software\Policies\Microsoft\Edge";
        private const string valueName = "HubsSidebarEnabled";
        private const int recommendedValue = 0;

        public override string GetFeatureDetails()
        {
            return $"{keyName} | Value: {valueName} | Recommended Value: {recommendedValue}";
        }

        public override string ID() => "Disable Copilot Symbol in Edge";

        public override string Info() => "This feature will disable Copilot in Microsoft Edge.";

        public override Task<bool> CheckFeature()
        {
            return Task.FromResult(Utils.IntEquals(keyName, valueName, 0));
        }

        public override Task<bool> DoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);

                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return Task.FromResult(false);
        }

        public override bool UndoFeature()
        {
            try
            {
                Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log("Code red in " + ex.Message, LogLevel.Error);
            }

            return false;
        }
    }
}

using System;
using System.Reflection;
using System.Windows.Forms;

namespace CrapFixer
{
    internal static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }

        /// <summary>
        /// Retrieves the version of the app
        /// </summary>
        /// <returns>The application version in the format "major.minor.build"</returns>
        public static string GetAppVersion()
        {
            // Get the version of the current executing assembly
            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            // Return the version in the format "major.minor.build"
            return $"{version.Major}.{version.Minor}.{version.Build}";
        }
    }
}

using Settings.Ads;
using Settings.AI;
using Settings.Edge;
using Settings.Gaming;
using Settings.Issues;
using Settings.Personalization;
using Settings.Privacy;
using Settings.System;
using Settings.UI;
using System.Collections.Generic;

namespace Features
{
    public static class FeatureLoader
    {
        public static List<FeatureNode> Load()
        {
            return new List<FeatureNode>
            {
               new FeatureNode("Issues")
                {
                    Children =
                    {
                        new FeatureNode(new BasicCleanup()),
                        new FeatureNode(new WingetUpgradeAll()) { DefaultChecked = false },
                    }
                },

              new FeatureNode("System")
                {
                    Children =
                    {
                       new FeatureNode(new BSODDetails()),
                       new FeatureNode(new VerboseStatus()),
                       new FeatureNode(new SpeedUpShutdown()),
                       new FeatureNode(new NetworkThrottling()),
                       new FeatureNode(new SystemResponsiveness()),
                       new FeatureNode(new MenuShowDelay()),
                       new FeatureNode(new TaskbarEndTask()),
                    }
                },

                new FeatureNode("MS Edge")
                {
                    Children =
                    {
                       new FeatureNode(new BrowserSignin()),
                       new FeatureNode(new DefaultTopSites()),
                       new FeatureNode(new DefautBrowserSetting()),
                       new FeatureNode(new EdgeCollections()),
                       new FeatureNode(new EdgeShoppingAssistant()),
                       new FeatureNode(new FirstRunExperience()),
                       new FeatureNode(new GamerMode()),
                       new FeatureNode(new HubsSidebar()),
                       new FeatureNode(new ImportOnEachLaunch()),
                       new FeatureNode(new StartupBoost()),
                       new FeatureNode(new TabPageQuickLinks()),
                       new FeatureNode(new UserFeedback()),
                    }
                },

               new FeatureNode("UI")
                {
                    Children =
                    {
                       new FeatureNode(new FullContextMenus()),
                       new FeatureNode(new LockScreen()),
                       new FeatureNode(new SearchboxTaskbarMode()),
                       new FeatureNode(new ShowOrHideMostUsedApps()),
                       new FeatureNode(new ShowTaskViewButton()),
                       new FeatureNode(new DisableSearchBoxSuggestions()),
                       new FeatureNode(new DisableBingSearch()),
                       new FeatureNode(new StartLayout()),
                       new FeatureNode(new TaskbarAlignment()),
                       new FeatureNode(new Transparency()),
                       new FeatureNode(new AppDarkMode()) { DefaultChecked = false },
                       new FeatureNode(new SystemDarkMode()) { DefaultChecked = false },
                       new FeatureNode(new DisableSnapAssistFlyout()),
                    }
                },

               new FeatureNode("Gaming")
                {
                    Children =
                    {
                       new FeatureNode(new GameDVR()),
                       new FeatureNode(new PowerThrottling()),
                       new FeatureNode(new VisualFX()),
                    }
                },

                new FeatureNode("Privacy")
                {
                    Children =
                    {
                       new FeatureNode(new ActivityHistory()),
                       new FeatureNode(new LocationTracking()),
                       new FeatureNode(new PrivacyExperience()),
                       new FeatureNode(new Telemetry()),
                    }
                },

                new FeatureNode("Ads")
                {
                    Children =
                    {
                        new FeatureNode(new FileExplorerAds()),
                        new FeatureNode(new FinishSetupAds()),
                        new FeatureNode(new LockScreenAds()),
                        new FeatureNode(new PersonalizedAds()),
                        new FeatureNode(new SettingsAds()),
                        new FeatureNode(new StartmenuAds()),
                        new FeatureNode(new TailoredExperiences()),
                        new FeatureNode(new TipsAndSuggestions()),
                        new FeatureNode(new WelcomeExperienceAds()),
                    }
                },

                new FeatureNode("AI")
                {
                    Children =
                    {
                       new FeatureNode(new CopilotTaskbar()),
                       new FeatureNode(new Recall()),
                       new FeatureNode(new ClickToDo()) { DefaultChecked = false },
                    }
                },
            };
        }
    }
}

//------------------------------------------------------------------------------
// <auto-generated>
//     Dieser Code wurde von einem Tool generiert.
//     Laufzeitversion:4.0.30319.42000
//
//     Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
//     der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------

namespace CFixer.Properties {

    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

        public static Settings Default {
            get {
                return defaultInstance;
            }
        }
    }
}

using System.Collections.Generic;
using CrapFixer;

public class FeatureNode
{
    public string Name { get; set; }
    public bool IsCategory => Feature == null;
    public FeatureBase Feature { get; }
    public List<FeatureNode> Children { get; set; } = new List<FeatureNode>();

   // Property to control default checked state
   public bool DefaultChecked { get; set; } = true;

    // Constructor for categories
    public FeatureNode(string name)
    {
        Name = name;
    }

    // Constructor for actual features
    public FeatureNode(FeatureBase feature)
    {
        Feature = feature;
        Name = feature.ID(); // Use the ID as the name
    }
}

using System.Threading.Tasks;

namespace CrapFixer
{
    public abstract class FeatureBase
    {
        public abstract string ID();
        public abstract string Info();
        public abstract string GetFeatureDetails();
        public abstract Task<bool> CheckFeature();  // async
        public abstract Task<bool> DoFeature();    // async
        public abstract bool UndoFeature();
    }

}

using System;
using System.Windows.Forms;
using Views;

namespace CFixer.Views
{
    public partial class OptionsView : UserControl
    {
        private NavigationManager subNavigation;

        public OptionsView()
        {
            InitializeComponent();
            subNavigation = new NavigationManager(panelSubContent);
            subNavigation.SwitchView(new AboutView()); // Startsite
        }

        private void btnAboutMenu_Click(object sender, EventArgs e)
        {
            subNavigation.SwitchView(new AboutView());
        }

        private void btnSettingsMenu_Click(object sender, EventArgs e)
        {
            subNavigation.SwitchView(new SettingsView());
        }

        private void btnPluginsMenu_Click(object sender, EventArgs e)
        {
            subNavigation.SwitchView(new PluginsView());
        }

        private void btnViveMenu_Click(object sender, EventArgs e)
        {
            subNavigation.SwitchView(new ViveView());
        }
    }
}

public static async Task<string> GetWindowsVersion () {}

This code segment functions to: Retrieve and compile detailed operating system version information from multiple system sources, including Windows Management Instrumentation data and registry entries, while detecting insider program participation status and handling potential execution errors gracefully.

```c_sharp
[TASK_BEGIN]
public static async Task<string> GetWindowsVersion()
{
    return await Task.Run(() =>
    {
        using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"))
        {
            if (key != null)
            {
                var major = key.GetValue("CurrentMajorVersionNumber") as int?;
                var minor = key.GetValue("CurrentMinorVersionNumber") as int?;

                if (major.HasValue && minor.HasValue)
                {
                    var build = key.GetValue("CurrentBuildNumber")?.ToString();
                    var ubr = key.GetValue("UBR")?.ToString();
                    return $"{major}.{minor}.{build}.{ubr}";
                }

                return key.GetValue("ProductName")?.ToString() ?? "Unknown";
            }
            return "Unknown";
        }
    });
}
[TASK_END]
```

public static async Task<string> GetWindowsVersion()
{
    return await Task.Run(() =>
    {
        using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"))
        {
            if (key != null)
            {
                var major = key.GetValue("CurrentMajorVersionNumber") as int?;
                var minor = key.GetValue("CurrentMinorVersionNumber") as int?;
                if (major.HasValue && minor.HasValue)
                {
                    var build = key.GetValue("CurrentBuildNumber")?.ToString();
                    var ubr = key.GetValue("UBR")?.ToString();
                    return $"{major}.{minor}.{build}.{ubr}";
                }
                return key.GetValue("ProductName")?.ToString() ?? "Unknown";
            }
            return "Unknown";
        }
    });
}