diff --git a/Perfect11.sln b/Perfect11.sln index c4a4594..cb4de19 100644 --- a/Perfect11.sln +++ b/Perfect11.sln @@ -11,6 +11,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfect11.Inbox.UninstallOn EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfect11.Inbox.ManageTelemetry", "tweaks\Perfect11.Inbox.ManageTelemetry\Perfect11.Inbox.ManageTelemetry.csproj", "{2F175C96-FDBA-49D8-BE83-1998C1F75FA2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfect11.Inbox.DisableAds", "tweaks\Perfect11.Inbox.DisableAds\Perfect11.Inbox.DisableAds.csproj", "{0BCF623D-B134-4824-9167-2F0A39532BDD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfect11.Inbox.Spotlight", "tweaks\Perfect11.Inbox.Spotlight\Perfect11.Inbox.Spotlight.csproj", "{77376E26-3164-4ED7-9F85-02B3AEBFC751}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +37,14 @@ Global {2F175C96-FDBA-49D8-BE83-1998C1F75FA2}.Debug|Any CPU.Build.0 = Debug|Any CPU {2F175C96-FDBA-49D8-BE83-1998C1F75FA2}.Release|Any CPU.ActiveCfg = Release|Any CPU {2F175C96-FDBA-49D8-BE83-1998C1F75FA2}.Release|Any CPU.Build.0 = Release|Any CPU + {0BCF623D-B134-4824-9167-2F0A39532BDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0BCF623D-B134-4824-9167-2F0A39532BDD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0BCF623D-B134-4824-9167-2F0A39532BDD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0BCF623D-B134-4824-9167-2F0A39532BDD}.Release|Any CPU.Build.0 = Release|Any CPU + {77376E26-3164-4ED7-9F85-02B3AEBFC751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77376E26-3164-4ED7-9F85-02B3AEBFC751}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77376E26-3164-4ED7-9F85-02B3AEBFC751}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77376E26-3164-4ED7-9F85-02B3AEBFC751}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Perfect11/Form1.Designer.cs b/Perfect11/Form1.Designer.cs index 90058de..991e6b7 100644 --- a/Perfect11/Form1.Designer.cs +++ b/Perfect11/Form1.Designer.cs @@ -51,6 +51,7 @@ this.tweaksPage = new ReaLTaiizor.Controls.PoisonTabPage(); this.runTweaks = new ReaLTaiizor.Controls.PoisonButton(); this.tweaksList = new ReaLTaiizor.Controls.PoisonListView(); + this.githubLink = new ReaLTaiizor.Controls.PoisonLinkLabel(); this.theme.SuspendLayout(); this.pages.SuspendLayout(); this.welcomePage.SuspendLayout(); @@ -62,8 +63,10 @@ // theme // this.theme.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(41)))), ((int)(((byte)(50))))); + this.theme.Controls.Add(this.githubLink); this.theme.Controls.Add(this.controlBoxEdit1); this.theme.Controls.Add(this.pages); + this.theme.Controls.Add(this.editionLabel); this.theme.Dock = System.Windows.Forms.DockStyle.Fill; this.theme.Font = new System.Drawing.Font("Segoe UI", 8F); this.theme.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(142)))), ((int)(((byte)(142)))), ((int)(((byte)(142))))); @@ -97,7 +100,7 @@ this.pages.Dock = System.Windows.Forms.DockStyle.Fill; this.pages.Location = new System.Drawing.Point(3, 28); this.pages.Name = "pages"; - this.pages.SelectedIndex = 1; + this.pages.SelectedIndex = 0; this.pages.Size = new System.Drawing.Size(1323, 732); this.pages.TabIndex = 1; this.pages.UseSelectable = true; @@ -106,7 +109,6 @@ // this.welcomePage.BackgroundImage = global::Perfect11.Properties.Resources.win11wallpaperdark; this.welcomePage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.welcomePage.Controls.Add(this.editionLabel); this.welcomePage.Controls.Add(this.poisonLabel2); this.welcomePage.Controls.Add(this.pictureBox1); this.welcomePage.Controls.Add(this.poisonLabel1); @@ -126,7 +128,7 @@ // this.editionLabel.AutoSize = true; this.editionLabel.BackColor = System.Drawing.Color.Transparent; - this.editionLabel.Location = new System.Drawing.Point(16, 656); + this.editionLabel.Location = new System.Drawing.Point(12, 763); this.editionLabel.Name = "editionLabel"; this.editionLabel.Size = new System.Drawing.Size(175, 19); this.editionLabel.TabIndex = 4; @@ -139,10 +141,10 @@ this.poisonLabel2.BackColor = System.Drawing.Color.Transparent; this.poisonLabel2.Location = new System.Drawing.Point(416, 379); this.poisonLabel2.Name = "poisonLabel2"; - this.poisonLabel2.Size = new System.Drawing.Size(465, 38); + this.poisonLabel2.Size = new System.Drawing.Size(459, 38); this.poisonLabel2.TabIndex = 3; this.poisonLabel2.Text = "Perfect11 is a tool made by a guy who loves to optimize Windows.\r\nIt allows to in" + - "stalls apps, remove bloatware, configure services and even more."; + "stalls apps, remove bloatware, tweak the system and even more."; this.poisonLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.poisonLabel2.UseCustomBackColor = true; // @@ -344,14 +346,12 @@ // // tweaksList // - this.tweaksList.AllowSorting = true; this.tweaksList.Font = new System.Drawing.Font("Segoe UI", 12F); this.tweaksList.FullRowSelect = true; this.tweaksList.Location = new System.Drawing.Point(0, 0); this.tweaksList.Name = "tweaksList"; this.tweaksList.OwnerDraw = true; this.tweaksList.Size = new System.Drawing.Size(1310, 617); - this.tweaksList.Sorting = System.Windows.Forms.SortOrder.Ascending; this.tweaksList.TabIndex = 2; this.tweaksList.UseCompatibleStateImageBehavior = false; this.tweaksList.UseCustomBackColor = true; @@ -360,6 +360,21 @@ this.tweaksList.UseStyleColors = true; this.tweaksList.Resize += new System.EventHandler(this.tweaksList_Resize); // + // githubLink + // + this.githubLink.BackColor = System.Drawing.Color.Transparent; + this.githubLink.Cursor = System.Windows.Forms.Cursors.Hand; + this.githubLink.Location = new System.Drawing.Point(1275, 762); + this.githubLink.Name = "githubLink"; + this.githubLink.Size = new System.Drawing.Size(48, 26); + this.githubLink.TabIndex = 5; + this.githubLink.Text = "GitHub"; + this.githubLink.UseCustomBackColor = true; + this.githubLink.UseCustomForeColor = true; + this.githubLink.UseSelectable = true; + this.githubLink.UseStyleColors = true; + this.githubLink.Click += new System.EventHandler(this.githubLink_Click); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F); @@ -377,6 +392,7 @@ this.TransparencyKey = System.Drawing.Color.Fuchsia; this.Load += new System.EventHandler(this.Form1_Load); this.theme.ResumeLayout(false); + this.theme.PerformLayout(); this.pages.ResumeLayout(false); this.welcomePage.ResumeLayout(false); this.welcomePage.PerformLayout(); @@ -412,6 +428,7 @@ private ReaLTaiizor.Controls.PoisonListView tweaksList; private ReaLTaiizor.Controls.PoisonButton runTweaks; private ReaLTaiizor.Controls.PoisonLabel editionLabel; + private ReaLTaiizor.Controls.PoisonLinkLabel githubLink; } } diff --git a/Perfect11/Form1.cs b/Perfect11/Form1.cs index d218d10..d161b6b 100644 --- a/Perfect11/Form1.cs +++ b/Perfect11/Form1.cs @@ -5,6 +5,7 @@ using ReaLTaiizor.Enum.Poison; using System; using System.Collections.Generic; using System.Data; +using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; @@ -56,6 +57,7 @@ namespace Perfect11 tweaksList.BackColor = Color.FromArgb(17, 17, 17); poisonLabel1.ForeColor = Color.FromArgb(255, 255, 255); poisonLabel2.ForeColor = Color.FromArgb(255, 255, 255); + githubLink.Theme = ThemeStyle.Dark; } else { @@ -82,13 +84,14 @@ namespace Perfect11 LstUWP.BackColor = Color.FromArgb(255,255,255); LstUWPRemove.BackColor = Color.FromArgb(255,255,255); tweaksList.BackColor = Color.FromArgb(255,255,255); + githubLink.Theme = ThemeStyle.Light; } } private void Form1_Load(object sender, EventArgs e) { pages.SelectedTab = welcomePage; // Always start from the first tab editionLabel.Text = AppEdition; - theme.Text = AppEdition; + //theme.Text = AppEdition; LstUWP.View = View.Details; LstUWP.Columns.Clear(); LstUWP.Columns.Add("App Name", -2, HorizontalAlignment.Left); @@ -185,13 +188,15 @@ namespace Perfect11 string command2 = $"Get-AppxProvisionedPackage -online | Where PackageName -like *\"{appName}\"* | Remove-AppxProvisionedPackage -online"; try { + string output3 = Utilities.EolApp(appName); string output2 = PowerShell.Execute(command2); string output = PowerShell.Execute(command); #if DEBUG + MessageBox.Show(output3); MessageBox.Show(output2); MessageBox.Show(output); #endif - if (!output.ToLower().Contains("error") && !output2.ToLower().Contains("error")) + if (!output.ToLower().Contains("error") && !output2.ToLower().Contains("error") && !output3.ToLower().Contains("error")) { success += "\t" + appName + "\n"; } @@ -210,7 +215,7 @@ namespace Perfect11 private void ChkShowUWPSystem_CheckedChanged(object sender, EventArgs e) { - if (ChkShowUWPSystem.Checked) MessageBox.Show("You're about to show system UWP apps. Those apps if removed can break several things in your system. Proceed with caution.", "Perfect11 - WARNING", MessageBoxButtons.OK); + if (ChkShowUWPSystem.Checked) MessageBox.Show("You're about to show system UWP apps. Those apps if removed can break several things in your system. Proceed with caution.", "Perfect11", MessageBoxButtons.OK, MessageBoxIcon.Warning); GetUWP(); } @@ -284,36 +289,63 @@ namespace Perfect11 } private void InitializeTweaks() { - if (!Directory.Exists("Tweaks")) - { - Directory.CreateDirectory("Tweaks"); - } - if (File.Exists("Tweaks\\Perfect11.TweaksInterface.dll")) - { - File.Delete("Tweaks\\Perfect11.TweaksInterface.dll"); - } - var categorizedPlugins = Utilities.LoadTweaks(@"Tweaks"); + const string tweaksFolder = "Tweaks"; + const string interfaceDll = "Perfect11.TweaksInterface.dll"; + + // Ensure folder exists and remove old interface DLL + if (!Directory.Exists(tweaksFolder)) + Directory.CreateDirectory(tweaksFolder); + + string interfacePath = Path.Combine(tweaksFolder, interfaceDll); + if (File.Exists(interfacePath)) + File.Delete(interfacePath); + + // Load categorized plugins + var categorizedPlugins = Utilities.LoadTweaks(tweaksFolder); + + // Setup ListView tweaksList.View = View.Details; - tweaksList.Columns.Clear(); - tweaksList.Columns.Add("Tweaks", -2, HorizontalAlignment.Left); - int totalWidth = tweaksList.ClientSize.Width; - tweaksList.Columns[0].Width = totalWidth; + tweaksList.FullRowSelect = true; + tweaksList.ShowGroups = true; tweaksList.Items.Clear(); tweaksList.Groups.Clear(); - tweaksList.FullRowSelect = true; - foreach (var category in categorizedPlugins) + + // Setup columns + tweaksList.Columns.Clear(); + tweaksList.Columns.Add("Tweak"); + tweaksList.Columns.Add("Description"); + AdjustListViewColumns(); + + // Add groups and items + foreach (var category in categorizedPlugins.OrderBy(c => c.Key)) { var group = new ListViewGroup(category.Key); tweaksList.Groups.Add(group); - foreach (var plugin in category.Value) + + foreach (var plugin in category.Value.OrderBy(p => p.Name)) { - var item = new ListViewItem(plugin.Name) { Group = group }; - item.Tag = plugin; + var item = new ListViewItem(plugin.Name) + { + Group = group, + Tag = plugin + }; + item.SubItems.Add(plugin.Description); tweaksList.Items.Add(item); } } - tweaksList.ShowGroups = true; - if (tweaksList.Items.Count == 0) runTweaks.Enabled = false; + + // Enable or disable run button + runTweaks.Enabled = tweaksList.Items.Count > 0; + } + + // Adjust column widths dynamically based on ListView client width + private void AdjustListViewColumns() + { + if (tweaksList.Columns.Count < 2) return; + + int totalWidth = tweaksList.ClientSize.Width; + tweaksList.Columns[0].Width = (int)(totalWidth * 0.3); // Tweak column + tweaksList.Columns[1].Width = (int)(totalWidth * 0.7); // Description column } private void InitializeDarkMode() { @@ -359,8 +391,19 @@ namespace Perfect11 private void tweaksList_Resize(object sender, EventArgs e) { - int totalWidth = tweaksList.ClientSize.Width; - tweaksList.Columns[0].Width = totalWidth; + AdjustListViewColumns(); + } + + private void githubLink_Click(object sender, EventArgs e) + { + try + { + Process.Start("https://github.com/theitaliandeveloper/Perfect11/"); + } + catch + { + MessageBox.Show("Looks like your browser is not available, please copy the link below and paste it in your browser's address bar:\n\nhttps://github.com/theitaliandeveloper/Perfect11/","Perfect11",MessageBoxButtons.OK,MessageBoxIcon.Information); + } } } } diff --git a/Perfect11/Library/Utilities.cs b/Perfect11/Library/Utilities.cs index f91e5a1..2ffef20 100644 --- a/Perfect11/Library/Utilities.cs +++ b/Perfect11/Library/Utilities.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using System.Security.Principal; namespace Perfect11.Library { @@ -55,5 +56,55 @@ namespace Perfect11.Library rk.Close(); return value == 0; } + public static string EolApp(string app) + { + try + { + // Use your PowerShell.Execute helper + string packageFullName = PowerShell.Execute( + "Get-AppxPackage -AllUsers | Where-Object { $_.PackageFullName -like '*" + app +"*' } | Select-Object -ExpandProperty PackageFullName" + ); + + if (string.IsNullOrWhiteSpace(packageFullName)) + { + return "Sticky Notes package not found."; + } + + Console.WriteLine($"Found package: {packageFullName}"); + + // Get current user SID + string userSid = WindowsIdentity.GetCurrent().User?.Value; + if (string.IsNullOrEmpty(userSid)) + { + return "Unable to get current user SID."; + } + + // Registry base path + string basePath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore"; + string[] subKeys = + { + $@"EndOfLife\{userSid}\{packageFullName}", + $@"EndOfLife\S-1-5-18\{packageFullName}", + $@"Deprovisioned\{packageFullName}" + }; + + foreach (var subKey in subKeys) + { + try + { + Registry.LocalMachine.CreateSubKey(basePath + "\\" + subKey); + } + catch (Exception ex) + { + return $"Error: {ex.Message}"; + } + } + return "Deprovision completed successfully."; + } + catch (Exception ex) + { + return $"Error: {ex.Message}"; + } + } } } diff --git a/Perfect11/Resources/UWPSystemAppList.txt b/Perfect11/Resources/UWPSystemAppList.txt index 56c735a..2fe97fe 100644 --- a/Perfect11/Resources/UWPSystemAppList.txt +++ b/Perfect11/Resources/UWPSystemAppList.txt @@ -19,7 +19,6 @@ Microsoft.Services.Store.Engagement Microsoft.VCLibs Microsoft.Win32WebViewHost Microsoft.WindowsStore -Microsoft.WindowsCalculator Microsoft.XboxGameCallableUI Microsoft.Windows.Apprep.ChxApp Microsoft.Windows.AssignedAccessLockApp diff --git a/README.md b/README.md index 34dc400..3313f41 100644 --- a/README.md +++ b/README.md @@ -1 +1,9 @@ -# Perfect11 \ No newline at end of file +# Perfect11 +Windows 11 customization and optimization toolkit. + +## How to use +1. Download [latest release](https://github.com/theitaliandeveloper/Perfect11/releases/latest) +2. Unzip the zip file +3. Run Perfect11.exe + +##### Copyright (C) 2025 Vichingo455 (The Italian Developer). All rights reserved. \ No newline at end of file diff --git a/tweaks/Perfect11.Inbox.ManageTelemetry/Tweak.cs b/tweaks/Perfect11.Inbox.ManageTelemetry/Tweak.cs index 70f08bd..d8cb8b1 100644 --- a/tweaks/Perfect11.Inbox.ManageTelemetry/Tweak.cs +++ b/tweaks/Perfect11.Inbox.ManageTelemetry/Tweak.cs @@ -102,15 +102,22 @@ namespace Perfect11.Inbox.ManageTelemetry } bool IsTelemetryActivated() { - RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection"); - int value = (int)rk.GetValue("AllowTelemetry"); - rk.Close(); - return value != 0; + try + { + RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection"); + int value = (int)rk.GetValue("AllowTelemetry"); + rk.Close(); + return value != 0; + } catch + { + return true; + } } if (IsTelemetryActivated()) { // Step 1: Registry - RegistryKey rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection"); + RegistryKey rk; + rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection"); rk.SetValue("AllowTelemetry",0,RegistryValueKind.DWord); rk.SetValue("MaxTelemetryAllowed", 0, RegistryValueKind.DWord); rk.Close(); @@ -143,7 +150,8 @@ namespace Perfect11.Inbox.ManageTelemetry else { // Step 1: Registry - RegistryKey rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection"); + RegistryKey rk; + rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection"); rk.DeleteValue("AllowTelemetry"); rk.DeleteValue("MaxTelemetryAllowed"); rk.Close(); diff --git a/tweaks/Perfect11.Inbox.UninstallOneDrive/Tweak.cs b/tweaks/Perfect11.Inbox.UninstallOneDrive/Tweak.cs index 25ea5bf..7d48c80 100644 --- a/tweaks/Perfect11.Inbox.UninstallOneDrive/Tweak.cs +++ b/tweaks/Perfect11.Inbox.UninstallOneDrive/Tweak.cs @@ -1,12 +1,9 @@ using Microsoft.Win32; using Perfect11.TweaksInterface; using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Perfect11.Inbox.UninstallOneDrive { @@ -28,6 +25,11 @@ namespace Perfect11.Inbox.UninstallOneDrive if (key != null) regExists = key.GetSubKeyNames().Any(n => n.ToLower().Contains("onedrive")); } + using (var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall")) + { + if (key != null) + regExists = key.GetSubKeyNames().Any(n => n.ToLower().Contains("onedrive")); + } } catch { }