diff --git a/src/BloatyNosy/Features/Apps/StoreApps.cs b/src/BloatyNosy/Features/Apps/StoreApps.cs index aa3f694..d6745ab 100644 --- a/src/BloatyNosy/Features/Apps/StoreApps.cs +++ b/src/BloatyNosy/Features/Apps/StoreApps.cs @@ -20,13 +20,13 @@ namespace Features.Feature.Apps return "To remove specific apps use the BloatPilot app in the \"More Apps\" section or right click on this feature"; } - private void RemoveApps(string str) + private void RemoveApps(string str, out bool removed) { + removed = false; bool error = false; using (PowerShell script = PowerShell.Create()) { script.AddScript("Get-AppxPackage " + str + " | Remove-AppxPackage"); - script.Invoke(); error = script.HadErrors; } @@ -38,9 +38,8 @@ namespace Features.Feature.Apps else { logger.Log("App removed " + str); + removed = true; } - - return; } public override bool CheckFeature() @@ -51,30 +50,46 @@ namespace Features.Feature.Apps powerShell.AddCommand("get-appxpackage"); powerShell.AddCommand("Select").AddParameter("property", "name"); - logger.Log("We found the following bloatware on your system: (if no apps are listed, then nothing was found)"); + bool foundMatches = false; // Flag variable to track if matches are found + logger.Log("The following bloatware has been found:"); foreach (PSObject result in powerShell.Invoke()) { - string current = result.ToString(); + string current = result.Properties["Name"].Value.ToString(); - if (!apps.Contains(Regex.Replace(current, "(@{Name=)|(})", ""))) continue; - logger.Log("[-] " + (Regex.Replace(current, "(@{Name=)|(})", ""))); + if (apps.Contains(Regex.Replace(current, "(@{Name=)|(})", ""))) + { + + foundMatches = true; + logger.Log((Regex.Replace(current, "(@{Name=)|(})", ""))); + } } - return true; + + if (!foundMatches) + { + logger.Log("Your system is free of bloatware."); + } + + return foundMatches; // Return value of foundMatches } public override bool DoFeature() { var apps = BloatwareList.GetList(); - logger.Log("Searching bloatware database..."); + bool foundAndDeleted = false; + foreach (var str in apps) { - logger.Log("[-] Uninstalling " + str.ToString()); - RemoveApps(str); + RemoveApps(str, out bool removed); + if (removed) + { + logger.Log("[-] Uninstalled " + str.ToString()); + foundAndDeleted = true; + } } - return true; + return foundAndDeleted; } public override bool UndoFeature() diff --git a/src/BloatyNosy/Features/Apps/StoreAppsPrivate.cs b/src/BloatyNosy/Features/Apps/StoreAppsPrivate.cs index d117258..cbe0287 100644 --- a/src/BloatyNosy/Features/Apps/StoreAppsPrivate.cs +++ b/src/BloatyNosy/Features/Apps/StoreAppsPrivate.cs @@ -13,12 +13,12 @@ namespace Features.Feature.Apps public override string ID() { - return "*[LOW] Remove bloatware based on private signature (Configure with a right-click)"; + return "*[LOW] Remove bloatware based on private database (Configure with a right-click)"; } public override string Info() { - return "Open the bloaty.txt file in the app directory of BloatyNosy to edit your signature or right click on this feature"; + return "Open the bloaty.txt file in the app directory of BloatyNosy to edit your database or right click on this feature"; } private void RemoveApps(string str) @@ -35,32 +35,54 @@ namespace Features.Feature.Apps public override bool CheckFeature() { - logger.Log("The following apps would be removed based on your private signature:"); - powerShell.Commands.Clear(); - powerShell.AddCommand("get-appxpackage"); - powerShell.AddCommand("Select").AddParameter("property", "name"); - try { - string[] num = File.ReadAllLines(HelperTool.Utils.Data.DataRootDir + "/bloaty.txt"); - - foreach (PSObject result in powerShell.Invoke()) + string bloatyFilePath = Path.Combine(HelperTool.Utils.Data.DataRootDir, "bloaty.txt"); + if (!File.Exists(bloatyFilePath)) { - string current = result.ToString(); // Get the current app + logger.Log("Your private signature is free of bloatware."); + return false; // Indicate failure + } - for (int i = 0; i < num.Length; i++) + string[] num = File.ReadAllLines(bloatyFilePath); + + using (PowerShell powerShell = PowerShell.Create()) + { + powerShell.AddCommand("get-appxpackage") + .AddCommand("Select").AddParameter("property", "name"); + + bool foundMatch = false; + logger.Log("The following apps would be removed based on your private bloatware database:"); + foreach (string line in num) { - string[] package = num[i].Split(':'); - string appx = package[0]; + string[] package = line.Split(':'); + string appx = package[0].Trim(); - if (current.Contains(appx)) - logger.Log("[-] App would be removed: " + appx); + foreach (PSObject result in powerShell.Invoke()) + { + string current = result.ToString(); // Get the current app + + if (current.Contains(appx)) + { + foundMatch = true; + logger.Log("[-] " + appx); + break; + } + } } + if (!foundMatch) + { + logger.Log("Your private scan is free of bloatware.\n[TIP] You can manually expand and maintain your private bloatware database \"bloaty.txt\" in \"app\" directory."); + } + + return foundMatch; // Return value of foundMatch } } - catch - { logger.Log("[!] Could not find private signature file \"bloaty.txt\" in " + HelperTool.Utils.Data.DataRootDir); } - return true; + catch (Exception ex) + { + logger.Log("[!] An error occurred: " + ex.Message); + return false; // Indicate failure + } } public override bool DoFeature() diff --git a/src/BloatyNosy/MainForm.Designer.cs b/src/BloatyNosy/MainForm.Designer.cs index 312fdb6..a86fafa 100644 --- a/src/BloatyNosy/MainForm.Designer.cs +++ b/src/BloatyNosy/MainForm.Designer.cs @@ -71,6 +71,7 @@ this.menuRestoreInfo = new System.Windows.Forms.ToolStripTextBox(); this.contextAppMenuOptions = new System.Windows.Forms.ContextMenuStrip(this.components); this.menuAppConfigure = new System.Windows.Forms.ToolStripMenuItem(); + this.btnBack = new System.Windows.Forms.Button(); this.pnlForm.SuspendLayout(); this.pnlMain.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbBackground)).BeginInit(); @@ -93,6 +94,7 @@ // this.pnlMain.AutoScroll = true; this.pnlMain.AutoSize = true; + this.pnlMain.Controls.Add(this.btnBack); this.pnlMain.Controls.Add(this.lnkUpdateCheck); this.pnlMain.Controls.Add(this._lblAssembly); this.pnlMain.Controls.Add(this.lnkAppMediaHelp); @@ -467,9 +469,9 @@ this.pbBackground.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.pbBackground.ErrorImage = null; this.pbBackground.InitialImage = null; - this.pbBackground.Location = new System.Drawing.Point(3, -49); + this.pbBackground.Location = new System.Drawing.Point(0, 36); this.pbBackground.Name = "pbBackground"; - this.pbBackground.Size = new System.Drawing.Size(445, 662); + this.pbBackground.Size = new System.Drawing.Size(445, 629); this.pbBackground.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pbBackground.TabIndex = 182; this.pbBackground.TabStop = false; @@ -653,6 +655,22 @@ this.menuAppConfigure.Text = "Configure this app"; this.menuAppConfigure.Click += new System.EventHandler(this.menuAppConfigure_Click); // + // btnBack + // + this.btnBack.BackColor = System.Drawing.Color.Transparent; + this.btnBack.FlatAppearance.BorderSize = 0; + this.btnBack.FlatAppearance.MouseOverBackColor = System.Drawing.Color.WhiteSmoke; + this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnBack.Font = new System.Drawing.Font("Segoe Fluent Icons", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnBack.ForeColor = System.Drawing.Color.Black; + this.btnBack.Location = new System.Drawing.Point(0, 0); + this.btnBack.Name = "btnBack"; + this.btnBack.Size = new System.Drawing.Size(42, 38); + this.btnBack.TabIndex = 220; + this.btnBack.Text = "..."; + this.btnBack.UseVisualStyleBackColor = false; + this.btnBack.Click += new System.EventHandler(this.btnBack_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -724,6 +742,7 @@ private System.Windows.Forms.LinkLabel lnkUpdateCheck; private System.Windows.Forms.ToolStripTextBox textHeaderAppInfo; private System.Windows.Forms.ToolStripTextBox textHeaderExperience; + private System.Windows.Forms.Button btnBack; } } diff --git a/src/BloatyNosy/MainForm.cs b/src/BloatyNosy/MainForm.cs index f596aed..0893ec7 100644 --- a/src/BloatyNosy/MainForm.cs +++ b/src/BloatyNosy/MainForm.cs @@ -38,6 +38,8 @@ namespace BloatyNosy private void SetStyle() { btnKebapMenu.Text = "\u22ee"; + btnBack.Text = "\uE72B"; + BackColor = tvwFeatures.BackColor = rtbLog.BackColor = @@ -561,7 +563,7 @@ namespace BloatyNosy } } - private void lnkStatus_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + private void btnBack_Click(object sender, EventArgs e) { if (rtbLog.Text == "") rtbLog.Text = "Windows 11 is too bloaty & nosy and has some annoying features that just need to go. " + @@ -584,6 +586,9 @@ namespace BloatyNosy } } + private void lnkStatus_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + => btnBack.PerformClick(); + private void lnkAppMediaGitHub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) => Process.Start(HelperTool.Utils.Uri.URL_GITREPO); @@ -598,5 +603,6 @@ namespace BloatyNosy private void lnkAppMediaDonate_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) => Process.Start(HelperTool.Utils.Uri.URL_DONATE); + } } \ No newline at end of file diff --git a/src/BloatyNosy/Properties/AssemblyInfo.cs b/src/BloatyNosy/Properties/AssemblyInfo.cs index 401c547..2a2740b 100644 --- a/src/BloatyNosy/Properties/AssemblyInfo.cs +++ b/src/BloatyNosy/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.80.0")] -[assembly: AssemblyFileVersion("0.80.0")] \ No newline at end of file +[assembly: AssemblyVersion("0.85.0")] +[assembly: AssemblyFileVersion("0.85.0")] \ No newline at end of file diff --git a/src/BloatyNosy/Views/AppsPageView.Designer.cs b/src/BloatyNosy/Views/AppsPageView.Designer.cs index 0da945b..0320402 100644 --- a/src/BloatyNosy/Views/AppsPageView.Designer.cs +++ b/src/BloatyNosy/Views/AppsPageView.Designer.cs @@ -195,7 +195,7 @@ this.btnBack.FlatAppearance.BorderSize = 0; this.btnBack.FlatAppearance.MouseOverBackColor = System.Drawing.Color.WhiteSmoke; this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnBack.Font = new System.Drawing.Font("Segoe Fluent Icons", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnBack.Font = new System.Drawing.Font("Segoe Fluent Icons", 9.75F, System.Drawing.FontStyle.Bold); this.btnBack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.btnBack.Location = new System.Drawing.Point(0, 0); this.btnBack.Name = "btnBack";