File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 <AllowUnsafeBlocks >True</AllowUnsafeBlocks >
1212 </PropertyGroup >
1313
14+ <PropertyGroup Condition =" '$(Configuration)' == 'Release' " >
15+ <PublishSingleFile >true</PublishSingleFile >
16+ <EnableCompressionInSingleFile >true</EnableCompressionInSingleFile >
17+ <SelfContained >true</SelfContained >
18+ <PublishTrimmed >true</PublishTrimmed >
19+ <TrimMode >full</TrimMode >
20+ <EnableTrimAnalyzer >true</EnableTrimAnalyzer >
21+ <EnableSingleFileAnalyzer >true</EnableSingleFileAnalyzer >
22+ <TrimmerSingleWarn >true</TrimmerSingleWarn >
23+ </PropertyGroup >
24+
25+ <PropertyGroup >
26+ <SatelliteResourceLanguages >en</SatelliteResourceLanguages >
27+ <IncludeNativeLibrariesForSelfExtract >true</IncludeNativeLibrariesForSelfExtract >
28+ </PropertyGroup >
29+
1430 <ItemGroup >
1531 <RuntimeHostConfigurationOption Include =" System.Runtime.EnableUnsafeBinaryFormatterSerialization" Value =" false" />
1632 </ItemGroup >
Original file line number Diff line number Diff line change 1010using Avalonia ;
1111using Avalonia . Threading ;
1212using CommunityToolkit . Mvvm . ComponentModel ;
13- using System . Management ;
1413using System . Diagnostics ;
14+ using Microsoft . Win32 ;
1515
1616namespace ProcessorLatencyTool . ViewModels
1717{
@@ -23,11 +23,10 @@ public static string CpuModel
2323 {
2424 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
2525 {
26- using var searcher = new ManagementObjectSearcher ( "SELECT * FROM Win32_Processor" ) ;
27- foreach ( var obj in searcher . Get ( ) )
28- {
29- return obj [ "Name" ] . ToString ( ) ?? "Unknown CPU" ;
30- }
26+ using var key = Registry . LocalMachine . OpenSubKey ( @"HARDWARE\DESCRIPTION\System\CentralProcessor\0" ) ;
27+ var processorName = key ? . GetValue ( "ProcessorNameString" ) ? . ToString ( ) ? . Trim ( ) ;
28+
29+ return processorName ?? "Unknown CPU" ;
3130 }
3231 else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
3332 {
You can’t perform that action at this time.
0 commit comments