in m1 parallels desktop
| /ms | net472 | net8 | net8-aot |
|---|---|---|---|
| console | 8-29 | 45 | |
| wpf-Loaded | 90-120 | 260 | - |
| console(cold) | 21 | 200 | |
| wpf-Loaded(cold) | 250 | 342 | - |
| using System; | |
| using System.Runtime.InteropServices; | |
| using Windows.Win32; | |
| using Windows.Win32.Foundation; | |
| using Windows.Win32.Graphics.Gdi; | |
| using Windows.Win32.UI.WindowsAndMessaging; | |
| internal static unsafe class App | |
| { | |
| private const string ClassName = "AppCoreApplication_MainWnd"; |
| function Get-ExeArchitecture { | |
| param([string]$Path) | |
| $bytes = [System.IO.File]::ReadAllBytes($Path) | |
| # 检查 PE 头标志 | |
| $machineType = [System.BitConverter]::ToUInt16($bytes, [System.BitConverter]::ToUInt16($bytes, 0x3C) + 4) | |
| switch ($machineType) { | |
| 0x014c { "x86 (32位)" } |
| extension(DependencyObject obj) | |
| { | |
| public Observable<T> GetObservable<T>(DependencyProperty property) | |
| { | |
| var descriptor = DependencyPropertyDescriptor.FromProperty(property, obj.GetType()); | |
| return Observable | |
| .FromEventHandler( | |
| h => descriptor.AddValueChanged(obj, h), | |
| h => descriptor.RemoveValueChanged(obj, h)) | |
| .Select(_ => (T)obj.GetValue(property)) |
| public partial class App : BlazoniaApplication<MainWindow> | |
| { | |
| public override void Initialize() | |
| { | |
| AvaloniaXamlLoader.Load(this); | |
| } | |
| } |
| <Project Sdk="Microsoft.NET.Sdk"> | |
| <PropertyGroup> | |
| <OutputType>WinExe</OutputType> | |
| <TargetFramework>net9.0-windows10.0.26100.0</TargetFramework> | |
| <UseWinUI>true</UseWinUI> | |
| <Nullable>enable</Nullable> | |
| <ImplicitUsings>true</ImplicitUsings> | |
| <ApplicationManifest>app.manifest</ApplicationManifest> | |
| </PropertyGroup> | |
| public class SplashScreen | |
| { | |
| public static SplashScreen Show(string imagePath) | |
| { | |
| using var image = Image.FromFile(imagePath); | |
| return InternalShow(image); | |
| } | |
| public static SplashScreen Show(Stream stream) | |
| { |
in m1 parallels desktop
| /ms | net472 | net8 | net8-aot |
|---|---|---|---|
| console | 8-29 | 45 | |
| wpf-Loaded | 90-120 | 260 | - |
| console(cold) | 21 | 200 | |
| wpf-Loaded(cold) | 250 | 342 | - |
| public static T? XmlDeserializer<T>(string text) | |
| { | |
| var serializer = new XmlSerializer(typeof(T)); | |
| using var reader = new StringReader(text); | |
| var result = (T?)serializer.Deserialize(reader); | |
| return result; | |
| } |
| using System.Windows.Threading; | |
| using System.Windows; | |
| using System.Windows.Interop; | |
| namespace MagnifierWpf; | |
| public class MagWindow : Window | |
| { | |
| private float magnification; | |
| private int _sourceWidth = 400; |
| using Microsoft.Win32; | |
| using System; | |
| using System.Diagnostics; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Runtime.InteropServices; | |
| namespace Installer | |
| { | |
| public class Installer |