mirror of
https://github.com/theitaliandeveloper/Perfect11.git
synced 2025-12-06 00:52:04 +00:00
More changes
This commit is contained in:
@@ -3,18 +3,23 @@
|
||||
public interface IPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// The display name of the plugin.
|
||||
/// The display name of the tweak.
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A short description of what the plugin does.
|
||||
/// A short description of what the tweak does.
|
||||
/// </summary>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The category of the tweak
|
||||
/// </summary>
|
||||
string Category { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Executes the plugin’s main logic.
|
||||
/// </summary>
|
||||
void Execute();
|
||||
string Execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfect11.TweaksInterface",
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfect11.Inbox.UninstallOneDrive", "tweaks\Perfect11.Inbox.UninstallOneDrive\Perfect11.Inbox.UninstallOneDrive.csproj", "{AD55727D-A52C-459D-A316-3459AA80050A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfect11.Inbox.ManageTelemetry", "tweaks\Perfect11.Inbox.ManageTelemetry\Perfect11.Inbox.ManageTelemetry.csproj", "{2F175C96-FDBA-49D8-BE83-1998C1F75FA2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -27,6 +29,10 @@ Global
|
||||
{AD55727D-A52C-459D-A316-3459AA80050A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AD55727D-A52C-459D-A316-3459AA80050A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AD55727D-A52C-459D-A316-3459AA80050A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2F175C96-FDBA-49D8-BE83-1998C1F75FA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
66
Perfect11/Form1.Designer.cs
generated
66
Perfect11/Form1.Designer.cs
generated
@@ -33,6 +33,7 @@
|
||||
this.controlBoxEdit1 = new ReaLTaiizor.Controls.ControlBoxEdit();
|
||||
this.pages = new ReaLTaiizor.Controls.PoisonTabControl();
|
||||
this.welcomePage = new ReaLTaiizor.Controls.PoisonTabPage();
|
||||
this.editionLabel = new ReaLTaiizor.Controls.PoisonLabel();
|
||||
this.poisonLabel2 = new ReaLTaiizor.Controls.PoisonLabel();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.poisonLabel1 = new ReaLTaiizor.Controls.PoisonLabel();
|
||||
@@ -48,9 +49,8 @@
|
||||
this.addButton = new ReaLTaiizor.Controls.PoisonButton();
|
||||
this.LstUWP = new ReaLTaiizor.Controls.PoisonListView();
|
||||
this.tweaksPage = new ReaLTaiizor.Controls.PoisonTabPage();
|
||||
this.tweaksList = new ReaLTaiizor.Controls.PoisonListView();
|
||||
this.runTweaks = new ReaLTaiizor.Controls.PoisonButton();
|
||||
this.editionLabel = new ReaLTaiizor.Controls.PoisonLabel();
|
||||
this.tweaksList = new ReaLTaiizor.Controls.PoisonListView();
|
||||
this.theme.SuspendLayout();
|
||||
this.pages.SuspendLayout();
|
||||
this.welcomePage.SuspendLayout();
|
||||
@@ -97,7 +97,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 = 2;
|
||||
this.pages.SelectedIndex = 0;
|
||||
this.pages.Size = new System.Drawing.Size(1323, 732);
|
||||
this.pages.TabIndex = 1;
|
||||
this.pages.UseSelectable = true;
|
||||
@@ -112,7 +112,7 @@
|
||||
this.welcomePage.Controls.Add(this.poisonLabel1);
|
||||
this.welcomePage.HorizontalScrollbarBarColor = true;
|
||||
this.welcomePage.HorizontalScrollbarHighlightOnWheel = false;
|
||||
this.welcomePage.HorizontalScrollbarSize = 11;
|
||||
this.welcomePage.HorizontalScrollbarSize = 6;
|
||||
this.welcomePage.Location = new System.Drawing.Point(4, 38);
|
||||
this.welcomePage.Name = "welcomePage";
|
||||
this.welcomePage.Size = new System.Drawing.Size(1315, 690);
|
||||
@@ -120,7 +120,17 @@
|
||||
this.welcomePage.Text = "Welcome";
|
||||
this.welcomePage.VerticalScrollbarBarColor = true;
|
||||
this.welcomePage.VerticalScrollbarHighlightOnWheel = false;
|
||||
this.welcomePage.VerticalScrollbarSize = 45;
|
||||
this.welcomePage.VerticalScrollbarSize = 31;
|
||||
//
|
||||
// editionLabel
|
||||
//
|
||||
this.editionLabel.AutoSize = true;
|
||||
this.editionLabel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.editionLabel.Location = new System.Drawing.Point(16, 656);
|
||||
this.editionLabel.Name = "editionLabel";
|
||||
this.editionLabel.Size = new System.Drawing.Size(183, 20);
|
||||
this.editionLabel.TabIndex = 4;
|
||||
this.editionLabel.Text = "Perfect11 Community Edition";
|
||||
//
|
||||
// poisonLabel2
|
||||
//
|
||||
@@ -128,7 +138,7 @@
|
||||
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(492, 40);
|
||||
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.";
|
||||
@@ -170,7 +180,7 @@
|
||||
this.debloatPage.Controls.Add(this.LstUWP);
|
||||
this.debloatPage.HorizontalScrollbarBarColor = true;
|
||||
this.debloatPage.HorizontalScrollbarHighlightOnWheel = false;
|
||||
this.debloatPage.HorizontalScrollbarSize = 11;
|
||||
this.debloatPage.HorizontalScrollbarSize = 6;
|
||||
this.debloatPage.Location = new System.Drawing.Point(4, 38);
|
||||
this.debloatPage.Name = "debloatPage";
|
||||
this.debloatPage.Size = new System.Drawing.Size(1315, 690);
|
||||
@@ -178,7 +188,7 @@
|
||||
this.debloatPage.Text = "Debloat";
|
||||
this.debloatPage.VerticalScrollbarBarColor = true;
|
||||
this.debloatPage.VerticalScrollbarHighlightOnWheel = false;
|
||||
this.debloatPage.VerticalScrollbarSize = 28;
|
||||
this.debloatPage.VerticalScrollbarSize = 19;
|
||||
//
|
||||
// BtnRunUninstaller
|
||||
//
|
||||
@@ -216,7 +226,7 @@
|
||||
this.ChkShowUWPSystem.AutoSize = true;
|
||||
this.ChkShowUWPSystem.Location = new System.Drawing.Point(5, 650);
|
||||
this.ChkShowUWPSystem.Name = "ChkShowUWPSystem";
|
||||
this.ChkShowUWPSystem.Size = new System.Drawing.Size(123, 15);
|
||||
this.ChkShowUWPSystem.Size = new System.Drawing.Size(134, 17);
|
||||
this.ChkShowUWPSystem.TabIndex = 8;
|
||||
this.ChkShowUWPSystem.Text = "Show System Apps";
|
||||
this.ChkShowUWPSystem.UseSelectable = true;
|
||||
@@ -303,7 +313,7 @@
|
||||
this.tweaksPage.Controls.Add(this.tweaksList);
|
||||
this.tweaksPage.HorizontalScrollbarBarColor = true;
|
||||
this.tweaksPage.HorizontalScrollbarHighlightOnWheel = false;
|
||||
this.tweaksPage.HorizontalScrollbarSize = 10;
|
||||
this.tweaksPage.HorizontalScrollbarSize = 6;
|
||||
this.tweaksPage.Location = new System.Drawing.Point(4, 38);
|
||||
this.tweaksPage.Name = "tweaksPage";
|
||||
this.tweaksPage.Size = new System.Drawing.Size(1315, 690);
|
||||
@@ -311,7 +321,18 @@
|
||||
this.tweaksPage.Text = "Tweak";
|
||||
this.tweaksPage.VerticalScrollbarBarColor = true;
|
||||
this.tweaksPage.VerticalScrollbarHighlightOnWheel = false;
|
||||
this.tweaksPage.VerticalScrollbarSize = 10;
|
||||
this.tweaksPage.VerticalScrollbarSize = 7;
|
||||
//
|
||||
// runTweaks
|
||||
//
|
||||
this.runTweaks.FontSize = ReaLTaiizor.Extension.Poison.PoisonButtonSize.Medium;
|
||||
this.runTweaks.Location = new System.Drawing.Point(1189, 633);
|
||||
this.runTweaks.Name = "runTweaks";
|
||||
this.runTweaks.Size = new System.Drawing.Size(121, 54);
|
||||
this.runTweaks.TabIndex = 3;
|
||||
this.runTweaks.Text = "Run Tweaks";
|
||||
this.runTweaks.UseSelectable = true;
|
||||
this.runTweaks.Click += new System.EventHandler(this.runTweaks_Click);
|
||||
//
|
||||
// tweaksList
|
||||
//
|
||||
@@ -327,30 +348,9 @@
|
||||
this.tweaksList.UseSelectable = true;
|
||||
this.tweaksList.Resize += new System.EventHandler(this.tweaksList_Resize);
|
||||
//
|
||||
// runTweaks
|
||||
//
|
||||
this.runTweaks.FontSize = ReaLTaiizor.Extension.Poison.PoisonButtonSize.Medium;
|
||||
this.runTweaks.Location = new System.Drawing.Point(1189, 633);
|
||||
this.runTweaks.Name = "runTweaks";
|
||||
this.runTweaks.Size = new System.Drawing.Size(121, 54);
|
||||
this.runTweaks.TabIndex = 3;
|
||||
this.runTweaks.Text = "Run Tweaks";
|
||||
this.runTweaks.UseSelectable = true;
|
||||
this.runTweaks.Click += new System.EventHandler(this.runTweaks_Click);
|
||||
//
|
||||
// editionLabel
|
||||
//
|
||||
this.editionLabel.AutoSize = true;
|
||||
this.editionLabel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.editionLabel.Location = new System.Drawing.Point(16, 656);
|
||||
this.editionLabel.Name = "editionLabel";
|
||||
this.editionLabel.Size = new System.Drawing.Size(175, 19);
|
||||
this.editionLabel.TabIndex = 4;
|
||||
this.editionLabel.Text = "Perfect11 Community Edition";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(41)))), ((int)(((byte)(50)))));
|
||||
this.ClientSize = new System.Drawing.Size(1329, 788);
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace Perfect11
|
||||
{
|
||||
@@ -272,25 +273,27 @@ namespace Perfect11
|
||||
{
|
||||
File.Delete("Tweaks\\Perfect11.TweaksInterface.dll");
|
||||
}
|
||||
var categorizedPlugins = Utilities.LoadTweaks(@"Tweaks");
|
||||
tweaksList.View = View.Details;
|
||||
tweaksList.Columns.Add("Name", 150);
|
||||
tweaksList.Columns.Add("Description", 300);
|
||||
tweaksList.FullRowSelect = true;
|
||||
tweaksList.Columns.Clear();
|
||||
tweaksList.Columns.Add("Tweaks", -2, HorizontalAlignment.Left);
|
||||
int totalWidth = tweaksList.ClientSize.Width;
|
||||
tweaksList.Columns[0].Width = (int)(totalWidth * 0.4);
|
||||
tweaksList.Columns[1].Width = (int)(totalWidth * 0.6);
|
||||
|
||||
// Load plugins
|
||||
_tweaks = Utilities.LoadTweaks("Tweaks");
|
||||
|
||||
// Populate ListView
|
||||
foreach (var plugin in _tweaks)
|
||||
tweaksList.Columns[0].Width = totalWidth;
|
||||
tweaksList.Items.Clear();
|
||||
tweaksList.Groups.Clear();
|
||||
tweaksList.FullRowSelect = true;
|
||||
foreach (var category in categorizedPlugins)
|
||||
{
|
||||
var item = new ListViewItem(plugin.Name);
|
||||
item.SubItems.Add(plugin.Description);
|
||||
item.Tag = plugin; // store the plugin object for later
|
||||
tweaksList.Items.Add(item);
|
||||
var group = new ListViewGroup(category.Key);
|
||||
tweaksList.Groups.Add(group);
|
||||
foreach (var plugin in category.Value)
|
||||
{
|
||||
var item = new ListViewItem(plugin.Name) { Group = group };
|
||||
item.Tag = plugin;
|
||||
tweaksList.Items.Add(item);
|
||||
}
|
||||
}
|
||||
tweaksList.ShowGroups = true;
|
||||
if (tweaksList.Items.Count == 0) runTweaks.Enabled = false;
|
||||
}
|
||||
private void InitializeDarkMode()
|
||||
@@ -320,7 +323,8 @@ namespace Perfect11
|
||||
{
|
||||
if (item.Tag is IPlugin plugin)
|
||||
{
|
||||
await Task.Run(() => plugin.Execute()); // run in background thread
|
||||
string result = await Task.Run(() => plugin.Execute()); // run in background thread
|
||||
MessageBox.Show(result,"Perfect11",MessageBoxButtons.OK,MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,8 +341,7 @@ namespace Perfect11
|
||||
private void tweaksList_Resize(object sender, EventArgs e)
|
||||
{
|
||||
int totalWidth = tweaksList.ClientSize.Width;
|
||||
tweaksList.Columns[0].Width = (int)(totalWidth * 0.4);
|
||||
tweaksList.Columns[1].Width = (int)(totalWidth * 0.6);
|
||||
tweaksList.Columns[0].Width = totalWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ namespace Perfect11.Library
|
||||
"CurrentBuildNumber", null);
|
||||
return int.TryParse(buildNumber, out int build) && build >= 22000;
|
||||
}
|
||||
public static List<IPlugin> LoadTweaks(string path)
|
||||
public static Dictionary<string, List<IPlugin>> LoadTweaks(string path)
|
||||
{
|
||||
var plugins = new List<IPlugin>();
|
||||
var categorizedPlugins = new Dictionary<string, List<IPlugin>>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
Directory.CreateDirectory(path);
|
||||
@@ -33,11 +33,20 @@ namespace Perfect11.Library
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (Activator.CreateInstance(type) is IPlugin plugin)
|
||||
plugins.Add(plugin);
|
||||
{
|
||||
var category = string.IsNullOrEmpty(plugin.Category) ? "Uncategorized" : plugin.Category;
|
||||
|
||||
if (!categorizedPlugins.ContainsKey(category))
|
||||
{
|
||||
categorizedPlugins[category] = new List<IPlugin>();
|
||||
}
|
||||
|
||||
categorizedPlugins[category].Add(plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return plugins;
|
||||
return categorizedPlugins;
|
||||
}
|
||||
public static bool IsAppsDarkMode()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{2F175C96-FDBA-49D8-BE83-1998C1F75FA2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Perfect11.Inbox.ManageTelemetry</RootNamespace>
|
||||
<AssemblyName>Perfect11.Inbox.ManageTelemetry</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Tweak.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Perfect11.TweaksInterface\Perfect11.TweaksInterface.csproj">
|
||||
<Project>{b3f8761a-b4b2-4378-9fe8-06bbfc39fce6}</Project>
|
||||
<Name>Perfect11.TweaksInterface</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Perfect11 Inbox Tweaks")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Vichingo455")]
|
||||
[assembly: AssemblyProduct("Perfect11")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2025 Vichingo455")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("2f175c96-fdba-49d8-be83-1998c1f75fa2")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
179
tweaks/Perfect11.Inbox.ManageTelemetry/Tweak.cs
Normal file
179
tweaks/Perfect11.Inbox.ManageTelemetry/Tweak.cs
Normal file
@@ -0,0 +1,179 @@
|
||||
using Microsoft.Win32;
|
||||
using Perfect11.TweaksInterface;
|
||||
using System.ServiceProcess;
|
||||
using System;
|
||||
using System.Management;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace Perfect11.Inbox.ManageTelemetry
|
||||
{
|
||||
public class Tweak : IPlugin
|
||||
{
|
||||
public string Name => "Enable/Disable Telemetry";
|
||||
public string Description => "Enable or Disable Telemetry components.";
|
||||
public string Category => "Privacy";
|
||||
public string Execute()
|
||||
{
|
||||
void ControlService(string serviceName, string action)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (ServiceController sc = new ServiceController(serviceName))
|
||||
{
|
||||
Console.WriteLine($"Service '{serviceName}' current status: {sc.Status}");
|
||||
|
||||
switch (action.ToLower())
|
||||
{
|
||||
case "start":
|
||||
if (sc.Status == ServiceControllerStatus.Stopped)
|
||||
{
|
||||
sc.Start();
|
||||
sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(10));
|
||||
Console.WriteLine("Service started successfully.");
|
||||
}
|
||||
else Console.WriteLine("Service is already running.");
|
||||
break;
|
||||
|
||||
case "stop":
|
||||
if (sc.Status == ServiceControllerStatus.Running)
|
||||
{
|
||||
sc.Stop();
|
||||
sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10));
|
||||
Console.WriteLine("Service stopped successfully.");
|
||||
}
|
||||
else Console.WriteLine("Service is not running.");
|
||||
break;
|
||||
|
||||
case "restart":
|
||||
if (sc.Status == ServiceControllerStatus.Running)
|
||||
{
|
||||
sc.Stop();
|
||||
sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10));
|
||||
sc.Start();
|
||||
sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(10));
|
||||
Console.WriteLine("Service restarted successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.Start();
|
||||
sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(10));
|
||||
Console.WriteLine("Service started successfully.");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Console.WriteLine("Invalid action. Use start | stop | restart");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
throw new Exception($"Service '{serviceName}' not found or cannot be controlled: {ex.Message}");
|
||||
}
|
||||
catch (System.ServiceProcess.TimeoutException)
|
||||
{
|
||||
throw new Exception("Operation timed out.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
}
|
||||
void SetServiceStartupType(string serviceName, string startupType)
|
||||
{
|
||||
try
|
||||
{
|
||||
// startupType can be: "Automatic", "Manual", or "Disabled"
|
||||
string wmiPath = $"Win32_Service.Name='{serviceName}'";
|
||||
using (ManagementObject service = new ManagementObject(wmiPath))
|
||||
{
|
||||
ManagementBaseObject inParams = service.GetMethodParameters("ChangeStartMode");
|
||||
inParams["StartMode"] = startupType;
|
||||
service.InvokeMethod("ChangeStartMode", inParams, null);
|
||||
Console.WriteLine($"Service '{serviceName}' startup type set to {startupType}.");
|
||||
}
|
||||
}
|
||||
catch (ManagementException ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
}
|
||||
bool IsTelemetryActivated()
|
||||
{
|
||||
RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection");
|
||||
int value = (int)rk.GetValue("AllowTelemetry");
|
||||
rk.Close();
|
||||
return value != 0;
|
||||
}
|
||||
if (IsTelemetryActivated())
|
||||
{
|
||||
// Step 1: Registry
|
||||
RegistryKey rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection");
|
||||
rk.SetValue("AllowTelemetry",0,RegistryValueKind.DWord);
|
||||
rk.SetValue("MaxTelemetryAllowed", 0, RegistryValueKind.DWord);
|
||||
rk.Close();
|
||||
rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\DataCollection");
|
||||
rk.SetValue("AllowTelemetry", 0, RegistryValueKind.DWord);
|
||||
rk.SetValue("MaxTelemetryAllowed", 0, RegistryValueKind.DWord);
|
||||
rk.Close();
|
||||
// Step 2: Stop and Disable Service
|
||||
ControlService("DiagTrack","stop");
|
||||
SetServiceStartupType("DiagTrack","Disabled");
|
||||
// Step 3: Hopefully Disable CompatTelRunner.exe
|
||||
ProcessStartInfo info = new ProcessStartInfo
|
||||
{
|
||||
FileName = "cmd.exe",
|
||||
Arguments = @"/c takeown /F C:\Windows\System32\CompatTelRunner.exe && icacls C:\Windows\System32\CompatTelRunner.exe /grant everyone:F",
|
||||
CreateNoWindow = true,
|
||||
WindowStyle = ProcessWindowStyle.Hidden
|
||||
};
|
||||
var proc = Process.Start(info);
|
||||
proc.WaitForExit();
|
||||
try
|
||||
{
|
||||
File.Move(@"C:\Windows\System32\CompatTelRunner.exe", @"C:\Windows\System32\CompatTelRunner.exe.backup");
|
||||
} catch
|
||||
{
|
||||
throw new Exception("Error while attempting to disable Telemetry file.");
|
||||
}
|
||||
return "Windows Telemetry has been disabled successfully!";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Step 1: Registry
|
||||
RegistryKey rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection");
|
||||
rk.DeleteValue("AllowTelemetry");
|
||||
rk.DeleteValue("MaxTelemetryAllowed");
|
||||
rk.Close();
|
||||
rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\DataCollection");
|
||||
rk.DeleteValue("AllowTelemetry");
|
||||
rk.DeleteValue("MaxTelemetryAllowed");
|
||||
rk.Close();
|
||||
// Step 2: Enable and Start Service
|
||||
SetServiceStartupType("DiagTrack", "Automatic");
|
||||
ControlService("DiagTrack", "start");
|
||||
// Step 3: Enable back CompatTelRunner.exe
|
||||
ProcessStartInfo info = new ProcessStartInfo
|
||||
{
|
||||
FileName = "cmd.exe",
|
||||
Arguments = @"/c takeown /F C:\Windows\System32\CompatTelRunner.exe.backup && icacls C:\Windows\System32\CompatTelRunner.exe.backup /grant everyone:F",
|
||||
CreateNoWindow = true,
|
||||
WindowStyle = ProcessWindowStyle.Hidden
|
||||
};
|
||||
var proc = Process.Start(info);
|
||||
proc.WaitForExit();
|
||||
try
|
||||
{
|
||||
File.Move(@"C:\Windows\System32\CompatTelRunner.exe.backup", @"C:\Windows\System32\CompatTelRunner.exe");
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new Exception("Error while attempting to enable back Telemetry file.");
|
||||
}
|
||||
return "Windows Telemetry has been enabled successfully!";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,8 @@ namespace Perfect11.Inbox.UninstallOneDrive
|
||||
{
|
||||
public string Name => "Uninstall OneDrive";
|
||||
public string Description => "Remove OneDrive from the system.";
|
||||
public void Execute()
|
||||
public string Category => "Apps";
|
||||
public string Execute()
|
||||
{
|
||||
// --- Step 0: Check if OneDrive exists ---
|
||||
bool Exists()
|
||||
@@ -165,8 +166,7 @@ namespace Perfect11.Inbox.UninstallOneDrive
|
||||
|
||||
DeleteTask(@"\OneDrive Reporting Task");
|
||||
DeleteTask(@"\OneDrive Standalone Update Task");
|
||||
|
||||
Console.WriteLine("OneDrive has been completely removed.");
|
||||
return "OneDrive uninstalled successfully.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user