work with some things

This commit is contained in:
2025-10-23 08:58:08 +02:00
parent c03146f094
commit 0cbd073d9e
7 changed files with 136 additions and 7 deletions

View File

@@ -36,7 +36,9 @@ namespace Perfect11
welcomePage.Theme = ThemeStyle.Dark;
debloatPage.Theme = ThemeStyle.Dark;
poisonLabel1.Theme = ThemeStyle.Dark;
poisonLabel1.ForeColor = Color.FromArgb(255,255,255);
poisonLabel2.Theme = ThemeStyle.Dark;
poisonLabel2.ForeColor = Color.FromArgb(255, 255, 255);
LblInstalledCount.Theme = ThemeStyle.Dark;
LblRemoveCount.Theme = ThemeStyle.Dark;
LstUWP.Theme = ThemeStyle.Dark;

View File

@@ -1,4 +1,5 @@
using Microsoft.Win32;
using Newtonsoft.Json;
using Perfect11.TweaksInterface;
using System;
using System.Collections.Generic;
@@ -10,6 +11,12 @@ using System.Security.Principal;
namespace Perfect11.Library
{
public class AppInfo
{
public string Name { get; set; }
public string Id { get; set; }
public bool Install { get; set; }
}
public class Utilities
{
public static bool IsWindows11()
@@ -112,5 +119,33 @@ namespace Perfect11.Library
string languageCode = CultureInfo.CurrentUICulture.Name;
return languageCode.ToLower();
}
public static List<AppInfo> LoadApps(string resourceName)
{
var assembly = Assembly.GetExecutingAssembly();
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
{
if (stream == null)
{
Console.WriteLine("❌ Risorsa non trovata: " + resourceName);
return new List<AppInfo>();
}
using (StreamReader reader = new StreamReader(stream))
{
string json = reader.ReadToEnd();
try
{
var apps = JsonConvert.DeserializeObject<List<AppInfo>>(json);
return apps ?? new List<AppInfo>();
}
catch (Exception ex)
{
Console.WriteLine("❌ Errore parsing JSON: " + ex.Message);
return new List<AppInfo>();
}
}
}
}
}
}

View File

@@ -60,6 +60,9 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="ReaLTaiizor, Version=3.8.1.3, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ReaLTaiizor.3.8.1.3\lib\net48\ReaLTaiizor.dll</HintPath>
</Reference>

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net48" />
<package id="ReaLTaiizor" version="3.8.1.3" targetFramework="net48" />
</packages>

View File

@@ -23,7 +23,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>

View File

@@ -5,12 +5,12 @@ 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.Spotlight")]
[assembly: AssemblyTitle("Perfect11 Inbox Tweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Perfect11.Inbox.Spotlight")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyCompany("Vichingo455")]
[assembly: AssemblyProduct("Perfect11")]
[assembly: AssemblyCopyright("Copyright © 2025 Vichingo455")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@@ -1,9 +1,10 @@
using Perfect11.TweaksInterface;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
using Perfect11.TweaksInterface;
namespace Perfect11.Inbox.Spotlight
{
@@ -14,7 +15,94 @@ namespace Perfect11.Inbox.Spotlight
public string Category => "Annoyances";
public string Execute()
{
bool IsNotWindowsSpotlight()
{
const string keyPath = @"SOFTWARE\Policies\Microsoft\Windows\CloudContent";
const string valueName = "DisableWindowsSpotlightFeatures";
try
{
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyPath))
{
if (key == null)
return false;
object value = key.GetValue(valueName);
if (value == null)
return false;
if (value is int intValue)
return intValue == 1;
string stringValue = value.ToString();
if (int.TryParse(stringValue, out int parsed))
return parsed == 1;
return false;
}
}
catch (Exception)
{
return false;
}
}
if (!IsNotWindowsSpotlight())
{
using (var key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\CloudContent"))
{
key?.SetValue("DisableCloudOptimizedContent", 1, RegistryValueKind.DWord);
}
using (var key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\CloudContent"))
{
key?.SetValue("DisableWindowsSpotlightFeatures", 1, RegistryValueKind.DWord);
key?.SetValue("DisableWindowsSpotlightWindowsWelcomeExperience", 1, RegistryValueKind.DWord);
key?.SetValue("DisableWindowsSpotlightOnActionCenter", 1, RegistryValueKind.DWord);
key?.SetValue("DisableWindowsSpotlightOnSettings", 1, RegistryValueKind.DWord);
key?.SetValue("DisableThirdPartySuggestions", 1, RegistryValueKind.DWord);
}
using (var key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"))
{
key?.SetValue("ContentDeliveryAllowed", 0, RegistryValueKind.DWord);
key?.SetValue("FeatureManagementEnabled", 0, RegistryValueKind.DWord);
key?.SetValue("SubscribedContentEnabled", 0, RegistryValueKind.DWord);
key?.SetValue("SubscribedContent-338387Enabled", 0, RegistryValueKind.DWord);
key?.SetValue("RotatingLockScreenOverlayEnabled", 0, RegistryValueKind.DWord);
}
using (var key = Registry.CurrentUser.CreateSubKey(
@"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"))
{
key?.SetValue("{2cc5ca98-6485-489a-920e-b3e88a6ccce3}", 1, RegistryValueKind.DWord);
}
return "Spotlight was disabled successfully.";
}
else
{
using (var key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\CloudContent"))
{
key.DeleteValue("DisableCloudOptimizedContent", false);
}
using (var key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\CloudContent"))
{
key.DeleteValue("DisableWindowsSpotlightFeatures", false);
key.DeleteValue("DisableWindowsSpotlightWindowsWelcomeExperience", false);
key.DeleteValue("DisableWindowsSpotlightOnActionCenter", false);
key.DeleteValue("DisableWindowsSpotlightOnSettings", false);
key.DeleteValue("DisableThirdPartySuggestions", false);
}
using (var key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"))
{
key.DeleteValue("ContentDeliveryAllowed", false);
key.DeleteValue("FeatureManagementEnabled", false);
key.DeleteValue("SubscribedContentEnabled", false);
key.DeleteValue("SubscribedContent-338387Enabled", false);
key.DeleteValue("RotatingLockScreenOverlayEnabled", false);
}
using (var key = Registry.CurrentUser.CreateSubKey(
@"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"))
{
key.DeleteValue("{2cc5ca98-6485-489a-920e-b3e88a6ccce3}", false);
}
return "Spotlight was enabled successfully.";
}
}
}
}