Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Belim authored Jul 22, 2020
1 parent a716b3a commit d9bc8b3
Show file tree
Hide file tree
Showing 7 changed files with 302 additions and 145 deletions.
4 changes: 4 additions & 0 deletions src/Bloatbox/Bloatbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<PropertyGroup>
<ApplicationIcon>bloatbox.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -86,6 +89,7 @@
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down
215 changes: 114 additions & 101 deletions src/Bloatbox/MainWindow.Designer.cs

Large diffs are not rendered by default.

128 changes: 95 additions & 33 deletions src/Bloatbox/MainWindow.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
Expand All @@ -17,13 +18,21 @@ public partial class MainWindow : Form
private List<string> _listSystemApps = new List<string>();

// General strings
private string _successRemove = "Successfully removed:\n";

private string _failedRemove = "Failed to remove:\n";
private readonly string _installCount = "My apps";

private readonly string _removeCount = "Remove apps";
private readonly string _nothingCount = "No apps to uninstall!";

// Community strings
private readonly string _uriPkg = "https://github.com/Sycnex/Windows10Debloater/raw/master/Windows10Debloater.ps1";
private readonly string _infoPkg = "This will download the PowerShell based Community version \"Windows10Debloater.ps1\"" +
"\n\nThis is a interactive script with prompts which runs the following functions:" +
"\n- Debloat (a list of Bloatware that is removed can be viewed on the authors GitHub repository)" +
"\n- Removes registry keys leftover that are associated with the bloatware apps" +
"\n- Protect privacy by stopping some telemetry functions, stops Cortana from being used as your Search Index, disables unneccessary scheduled tasks, and more" +
"\n- Stop-EdgePDF" +
"\r\n\nDo you wish to continue?\r\n\nMore information about this script can be found here https://github.com/Sycnex/Windows10Debloater";

// Update strings
private readonly string _releaseURL = "https://raw.githubusercontent.com/builtbybel/bloatbox/master/latest.txt";

Expand All @@ -36,7 +45,7 @@ public partial class MainWindow : Form
/// <summary>
/// Check for updates
/// </summary>
private void CheckNewReleases_Click(object sender, EventArgs e)
private void CheckUpdates_Click(object sender, EventArgs e)
{
try
{
Expand Down Expand Up @@ -90,6 +99,9 @@ public MainWindow()
BtnClear.Text = "\ue894"; // Clear
}

/// <summary>
/// Retrieve UWP apps
/// </summary>
private void GetUWP()
{
LstUWP.Items.Clear();
Expand All @@ -110,16 +122,22 @@ private void GetUWP()
string appInst = LstUWP.Items.ToString();
foreach (string item in LstUWPRemove.Items) if (item.Any(appInst.Contains)) LstUWP.Items.Remove(item);

RefreshInstalled();
RefreshUWP();
}

private void BtnRefresh_Click(object sender, EventArgs e)
{
GetUWP();
}

/// <summary>
/// App uninstaller
/// </summary>
private string RemoveUWP()
{
string success = "Successfully removed:\n";
string failed = "Failed to remove:\n";

foreach (var item in LstUWPRemove.Items)
{
powerShell.Commands.Clear();
Expand All @@ -132,32 +150,31 @@ private string RemoveUWP()
foreach (var p in powerShell.Streams.Progress)
{
if (p.Activity.Contains(item.ToString()) && p.StatusDescription == "Completed") // Removed successfully
{
_successRemove += "\t" + item.ToString() + "\n";
// Console.WriteLine( _successRemove + item.ToString());
{
success += "\t" + item.ToString() + "\n";
// Console.WriteLine(success + item.ToString());
break;
}
else if (p.Activity.Contains(item.ToString()) && p.StatusDescription == "Error") // NOT removed
{
if (!_failedRemove.Contains(item.ToString())) _failedRemove += "\t" + item.ToString() + "\n";
// Console.WriteLine(_failedRemove + p.Activity);
}
}

powerShell.Streams.Progress.Clear();

/* Detailed log OFF!
if (powerShell.HadErrors) foreach (var p in powerShell.Streams.Error) { Console.WriteLine("\n\nERROR:\n" + p.ToString() + "\n\n"); } */
}

string outputPS = "";
if (powerShell.HadErrors) { outputPS = _successRemove + "\n" + _failedRemove; powerShell.Streams.Error.Clear(); }
else { outputPS = _successRemove; }

if (!failed.Contains(item.ToString())) failed += "\t" + item.ToString() + "\n";
// Console.WriteLine(failed + p.Activity);
}
}

powerShell.Streams.Progress.Clear();
/* Detailed lof OFF
if (powerShell.HadErrors) foreach (var p in powerShell.Streams.Error) { Console.WriteLine("\n\nERROR:\n" + p.ToString() + "\n\n"); } */
}

string outputPS = "";
if (powerShell.HadErrors) { outputPS = success + "\n" + failed; powerShell.Streams.Error.Clear(); }
else { outputPS = success; }

return outputPS;
}

private void RefreshInstalled()
private void RefreshUWP()
{
int installed = LstUWP.Items.Count;
int remove = LstUWPRemove.Items.Count;
Expand Down Expand Up @@ -240,7 +257,7 @@ private void BtnAddAll_Click(object sender, EventArgs e)
// LstUWP.Items.Remove(item);
}
LstUWP.Items.Clear();
RefreshInstalled();
RefreshUWP();
}

private void BtnAdd_Click(object sender, EventArgs e)
Expand All @@ -253,7 +270,7 @@ private void BtnAdd_Click(object sender, EventArgs e)
LstUWPRemove.Items.Add(LstUWP.SelectedItem);
LstUWP.Items.Remove(LstUWP.SelectedItem);
}
RefreshInstalled();
RefreshUWP();
}
}

Expand All @@ -265,7 +282,7 @@ private void BtnRemoveAll_Click(object sender, EventArgs e)
// LstUWP.Items.Remove(item);
}
LstUWPRemove.Items.Clear();
RefreshInstalled();
RefreshUWP();
}

private void BtnRemove_Click(object sender, EventArgs e)
Expand All @@ -278,7 +295,7 @@ private void BtnRemove_Click(object sender, EventArgs e)
LstUWP.Items.Add(LstUWPRemove.SelectedItem);
LstUWPRemove.Items.Remove(LstUWPRemove.SelectedItem);
}
RefreshInstalled();
RefreshUWP();
}
}

Expand Down Expand Up @@ -307,11 +324,6 @@ private void LstUWPRemove_DoubleClick(object sender, EventArgs e)
BtnRemove_Click(sender, e);
}

private void LnkMSSettingsAppsandfeatures_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("ms-settings:appsfeatures");
}

private void LblMainMenu_Click(object sender, EventArgs e)
{
this.MainMenu.Show(Cursor.Position.X, Cursor.Position.Y);
Expand All @@ -331,5 +343,55 @@ private void AppInfo_Click(object sender, EventArgs e)
"(C) 2020, Builtbybel (former Mirinsoft)",
"Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

/// <summary>
/// Download optional community version Windows10Debloater.ps1
/// </summary>
private void LnkGetCommunityVer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (MessageBox.Show(_infoPkg, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
PBar.Visible = true;
var pkg = _uriPkg;

try
{
WebClient wc = new WebClient();
wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
wc.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);

wc.DownloadFileAsync(new Uri(pkg.Trim()), @"Windows10Debloater.ps1");
}
catch (Exception ex)
{ MessageBox.Show(ex.Message, this.Text); }
}
}

public void DownloadProgressChanged(Object sender, DownloadProgressChangedEventArgs e)
{
PBar.Value = e.ProgressPercentage;
}

public void Completed(object sender, AsyncCompletedEventArgs e)
{
try
{
var ps1File = @"Windows10Debloater.ps1";
var startInfo = new ProcessStartInfo()
{
FileName = "powershell.exe",
Arguments = $"-NoProfile -ExecutionPolicy unrestricted -file \"{ps1File}\"",
UseShellExecute = true,
CreateNoWindow = true
};
Process.Start(startInfo);
PBar.Visible = false;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, this.Text);
PBar.Visible = false;
}
}
}
}
13 changes: 6 additions & 7 deletions src/Bloatbox/MainWindow.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,12 @@
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="LinkGitHub.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAEcSURBVEhL7dU9SgNBHIbxtbAx4gcBGxFL7SPYeg2LnEALL2ApFhaCCLZiCitLhVRBEDxAQFsP
YCUIiqA+j86ILNmQmSVdXvjB7O4/+yaTsCkmSc0CtmryHpVx4Ksm71GZWLAX1il8zcgFg4YW0QpmPFHK
sNf+ZdDQEi7wDq/pFSeYQ0xWwTKe8IZ488hzD2jCZBVcweM1bGMXO2hjFV7z05nkAvf8Ay9hXc4snuHW
uVXJBZthfYOq+O6d2UBywXpY91GVHpxxNrlgGm7PIw7hnk/BrGAfn3DG2eQCc4AuTtHxRMgtnJPlJqug
gTtcw19QzCWcu4dftskqMPM4wvnP0W/OcIz/D7bsglGTVDD2h10dQwvG/oczSSlF8Q3qQonB/m9ttAAA
AABJRU5ErkJggg==
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAALGPC/xhBQAAARxJREFUSEvt
1T1KA0EchvG1sDHiBwEbEUvtI9h6DYucQAsvYCkWFoIItmIKK0uFVEEQPEBAWw9gJQiKoD6Pzogs2ZCZ
JV1e+MHs7j/7JpOwKSZJzQK2avIelXHgqybvUZlYsBfWKXzNyAWDhhbRCmY8Ucqw1/5l0NASLvAOr+kV
J5hDTFbBMp7whnjzyHMPaMJkFVzB4zVsYxc7aGMVXvPTmeQC9/wDL2Fdziye4da5VckFm2F9g6r47p3Z
QHLBelj3UZUenHE2uWAabs8jDuGeT8GsYB+fcMbZ5AJzgC5O0fFEyC2ck+Umq6CBO1zDX1DMJZy7h1+2
ySow8zjC+c/Rb85wjP8PtuyCUZNUMPaHXR1DC8b+hzNJKUXxDepCicH+b220AAAAAElFTkSuQmCC
</value>
</data>
</root>
10 changes: 8 additions & 2 deletions src/Bloatbox/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ static class Program
internal static string GetCurrentVersionTostring() => new Version(Application.ProductVersion).ToString(3);

/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainWindow());

if (Environment.OSVersion.Version.Build < 9200)

MessageBox.Show("You are running Bloatbox on a system older than Windows 10. Bloatbox is limited to Windows 10 ONLY.", "Bloatbox", MessageBoxButtons.OK, MessageBoxIcon.Information);
else
Application.Run(new MainWindow());

}
}
}
4 changes: 2 additions & 2 deletions src/Bloatbox/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.11.1")]
[assembly: AssemblyFileVersion("0.11.1")]
[assembly: AssemblyVersion("0.12.0")]
[assembly: AssemblyFileVersion("0.12.0")]
73 changes: 73 additions & 0 deletions src/Bloatbox/app.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC-Manifestoptionen
Wenn Sie die Ebene der Benutzerkontensteuerung für Windows ändern möchten, ersetzen Sie den
Knoten "requestedExecutionLevel" wie folgt.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Durch Angabe des Elements "requestedExecutionLevel" wird die Datei- und Registrierungsvirtualisierung deaktiviert.
Entfernen Sie dieses Element, wenn diese Virtualisierung aus Gründen der Abwärtskompatibilität
für die Anwendung erforderlich ist.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Eine Liste der Windows-Versionen, unter denen diese Anwendung getestet
und für die sie entwickelt wurde. Wenn Sie die Auskommentierung der entsprechenden Elemente aufheben,
wird von Windows automatisch die kompatibelste Umgebung ausgewählt. -->

<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->

<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->

<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->

<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->

<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->

</application>
</compatibility>

<!-- Gibt an, dass die Anwendung mit DPI-Werten kompatibel ist und von Windows nicht automatisch auf höhere
DPI-Werte skaliert wird. WPF-Anwendungen (Windows Presentation Foundation) sind automatisch mit DPI-Werten kompatibel und müssen sich nicht
anmelden. Für Windows Forms-Anwendungen für .NET Framework 4.6, die sich für diese Einstellung anmelden, muss
auch die Einstellung "'EnableWindowsFormsHighDpiAutoResizing" in der "app.config" auf "true" festgelegt werden. -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
<!-- Designs für allgemeine Windows-Steuerelemente und -Dialogfelder (Windows XP und höher) aktivieren -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->

</assembly>

0 comments on commit d9bc8b3

Please sign in to comment.