From f9750bdc22830780258dca0d981a95b3d57fed41 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Sat, 30 Nov 2024 20:10:59 +0800 Subject: [PATCH] feat: More info on titlebar --- WndMain.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/WndMain.cs b/WndMain.cs index eda1707..8d1f375 100644 --- a/WndMain.cs +++ b/WndMain.cs @@ -8,6 +8,7 @@ using OpenCvSharp; using OpenCvSharp.Extensions; using System.Diagnostics; +using System.Runtime.InteropServices; namespace OpenLuckyRandom { @@ -38,6 +39,35 @@ public WndMain() frameThicknessNum.Value = frameThickness; cascadesComboBox.SelectedIndex = 0; + // 检查当前进程架构 + string _architecture; + switch (RuntimeInformation.ProcessArchitecture) + { + case Architecture.X86: + _architecture = "x86"; + break; + case Architecture.X64: + _architecture = "x64"; + break; + case Architecture.Arm: + _architecture = "ARM32"; + break; + case Architecture.Arm64: + _architecture = "ARM64"; + break; + default: + _architecture = "Unknown"; + break; + } + + // 检查是否为调试版本 + bool _isDebugBuild = typeof(WndMain).Assembly.GetCustomAttributes(false) + .OfType() + .Any(da => da.IsJITTrackingEnabled || da.IsJITOptimizerDisabled); + + // 设置窗体标题 + this.Text = $"OpenLuckyRandom ({_architecture}) {(_isDebugBuild ? "[Debug]" : "")}"; + // 组件整体刷新 this.Refresh(); }