Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
built-in method
Greedeksf0fb8ed86b12
diff --git a/.Source/GTweak/Core/ViewModel/MainViewModel.cs b/.Source/GTweak/Core/ViewModel/MainViewModel.csindex 766b269f..5216e332 100644--- a/.Source/GTweak/Core/ViewModel/MainViewModel.cs+++ b/.Source/GTweak/Core/ViewModel/MainViewModel.cs@@ -1,7 +1,6 @@using GTweak.Utilities.Configuration;using System;using System.Reflection;-using System.Windows;using System.Windows.Input;using System.Windows.Media;@@ -17,9 +16,9 @@ namespace GTweak.Core.ViewModelset { _currentView = value; OnPropertyChanged(); }}- public ImageSource DisplayProfileAvatar => new SystemDiagnostics().GetProfileImage() ?? Application.Current.Resources["DI_AvatarProfile"] as DrawingImage;+ public ImageSource DisplayProfileAvatar => SystemDiagnostics.GetProfileImage();- public string DisplayProfileName => new SystemDiagnostics().GetProfileName();+ public string DisplayProfileName => SystemDiagnostics.GetProfileName();public string DisplayTweakVersion => (Assembly.GetEntryAssembly() ?? throw new InvalidOperationException()).GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;diff --git a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.csindex e73eb761..6e2ea58f 100644--- a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs+++ b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs@@ -11,6 +11,7 @@ using System.Linq;using System.Management;using System.Net;using System.Net.Http;+using System.Security.Principal;using System.Text;using System.Text.RegularExpressions;using System.Threading.Tasks;@@ -80,20 +81,13 @@ namespace GTweak.Utilities.Configurationinternal static bool isIPAddressFormatValid = false;- internal ImageSource GetProfileImage()+ internal static ImageSource GetProfileImage(){- try- {- RegistryKey regKey = default, ourKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users", true);-- foreach (string keyname in ourKey!.GetSubKeyNames())- regKey = ourKey!.OpenSubKey(keyname);- return new BitmapImage(new Uri(regKey?.GetValue("Image1080").ToString() ?? string.Empty));- }- catch { return null; }+ string imageSrc = RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users\{WindowsIdentity.GetCurrent().User?.Value}", "Image1080", string.Empty);+ return !string.IsNullOrWhiteSpace(imageSrc) ? new BitmapImage(new Uri(imageSrc)) : Application.Current.Resources["DI_AvatarProfile"] as ImageSource;}- internal string GetProfileName()+ internal static string GetProfileName(){string nameProfile = string.Empty;