Skip to content

Commit e1fcd38

Browse files
committed
update publish info
1 parent edb6818 commit e1fcd38

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

ProcessorLatencyTool/ProcessorLatencyTool.csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@
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>

ProcessorLatencyTool/ViewModels/MainWindowViewModel.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
using Avalonia;
1111
using Avalonia.Threading;
1212
using CommunityToolkit.Mvvm.ComponentModel;
13-
using System.Management;
1413
using System.Diagnostics;
14+
using Microsoft.Win32;
1515

1616
namespace 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
{

0 commit comments

Comments
 (0)