7
7
using ImGuiNET ;
8
8
using T3 . Editor . Gui . Styling ;
9
9
using T3 . Editor . Gui . UiHelpers ;
10
+ using T3 . Editor . App ;
11
+ using System . Windows . Forms ;
12
+
10
13
11
14
namespace T3 . Editor . Gui . Dialog ;
12
15
@@ -19,22 +22,58 @@ internal void Draw()
19
22
if ( BeginDialog ( "About TiXL" ) )
20
23
{
21
24
FormInputs . AddSectionHeader ( "TiXL" ) ;
22
- ImGui . TextColored ( new Vector4 ( 1.0f , 0.2f , 0.55f , 1.0f ) , "v " + Program . VersionText ) ;
23
- FormInputs . AddVerticalSpace ( 5 ) ;
25
+ ImGui . SameLine ( ) ;
26
+ ImGui . PushStyleColor ( ImGuiCol . Text , UiColors . TextMuted . Rgba ) ;
27
+
28
+ FormInputs . AddSectionHeader ( "v." + Program . VersionText ) ;
29
+ ImGui . PopStyleColor ( ) ;
30
+ ImGui . PushStyleVar ( ImGuiStyleVar . ItemSpacing , mySpacing ) ;
31
+ ImGui . TextColored ( UiColors . TextMuted , $ "{ dateTime } ") ;
32
+ #if DEBUG
33
+ ImGui . TextColored ( UiColors . TextMuted , "IDE:" ) ;
34
+ ImGui . SameLine ( ) ;
35
+ ImGui . Text ( $ "{ ideName } ") ;
36
+ #endif
37
+
38
+ ImGui . TextColored ( UiColors . TextMuted , $ "App language:") ;
39
+ ImGui . SameLine ( ) ;
40
+ ImGui . Text ( $ "{ appLanguage } ") ;
41
+ ImGui . PopStyleVar ( ) ;
42
+ FormInputs . AddVerticalSpace ( 1 ) ;
24
43
ImGui . Separator ( ) ;
25
44
26
45
FormInputs . AddSectionHeader ( "System Information" ) ;
27
46
28
- if ( string . IsNullOrEmpty ( _systemInfo ) )
29
- {
30
- UpdateSystemInfo ( ) ; // Populate system info if not already done
31
- }
32
-
33
- FormInputs . AddVerticalSpace ( 5 ) ;
34
- ImGui . TextWrapped ( _systemInfo ) ;
35
- FormInputs . AddVerticalSpace ( 5 ) ;
47
+ //FormInputs.AddVerticalSpace(0);
48
+ ImGui . PushStyleVar ( ImGuiStyleVar . ItemSpacing , mySpacing ) ;
49
+ ImGui . TextColored ( UiColors . TextMuted , "OS:" ) ;
50
+ ImGui . SameLine ( ) ;
51
+ ImGui . Text ( $ "{ operatingSystemInfo } ") ;
52
+ ImGui . TextColored ( UiColors . TextMuted , "System language:" ) ;
53
+ ImGui . SameLine ( ) ;
54
+ ImGui . Text ( $ "{ systemLanguage } ") ;
55
+ ImGui . TextColored ( UiColors . TextMuted , "Keyboard layout:" ) ;
56
+ ImGui . SameLine ( ) ;
57
+ ImGui . Text ( $ "{ keyboardLayout } ") ;
36
58
59
+ FormInputs . AddVerticalSpace ( 8 ) ;
37
60
61
+ ImGui . TextColored ( UiColors . TextMuted , ".NET Runtime:" ) ;
62
+ ImGui . SameLine ( ) ;
63
+ ImGui . Text ( $ "{ dotNetRuntime } ") ;
64
+ ImGui . TextColored ( UiColors . TextMuted , ".NET SDK:" ) ;
65
+ ImGui . SameLine ( ) ;
66
+ ImGui . Text ( $ "{ dotNetSdk } ") ;
67
+
68
+ FormInputs . AddVerticalSpace ( 8 ) ;
69
+
70
+ ImGui . TextColored ( UiColors . TextMuted , "Graphics processing unit(s):" ) ;
71
+ ImGui . Text ( $ "{ gpuInformation } ") ;
72
+ FormInputs . AddVerticalSpace ( 8 ) ;
73
+ ImGui . Separator ( ) ;
74
+ ImGui . PopStyleVar ( ) ;
75
+
76
+ FormInputs . AddVerticalSpace ( 5 ) ;
38
77
if ( ImGui . Button ( "Copy System Information" ) )
39
78
{
40
79
UpdateSystemInfo ( ) ; // Update system info and copy to clipboard
@@ -61,11 +100,15 @@ private void UpdateSystemInfo()
61
100
{
62
101
var systemInfo = new StringBuilder ( ) ;
63
102
64
- systemInfo . AppendLine ( $ "Date: { DateTime . Now } ") ;
103
+ systemInfo . AppendLine ( $ "{ dateTime } ") ;
65
104
systemInfo . AppendLine ( $ "TiXL version: { Program . VersionText } ") ;
66
- systemInfo . AppendLine ( $ "Language: { GetAppLanguage ( ) } ") ;
105
+ #if DEBUG
106
+ systemInfo . AppendLine ( $ "IDE: { GetIdeName ( ) } ") ;
107
+ #endif
108
+ systemInfo . AppendLine ( $ "App language: { GetAppLanguage ( ) } ") ;
67
109
systemInfo . AppendLine ( $ "OS: { GetOperatingSystemInfo ( ) } ") ;
68
110
systemInfo . AppendLine ( $ "System language: { GetSystemLanguage ( ) } ") ;
111
+ systemInfo . AppendLine ( $ "Keyboard Layout: { GetKeyboardLayout ( ) } ") ;
69
112
systemInfo . AppendLine ( $ ".NET runtime: { GetDotNetRuntimeVersion ( ) } ") ;
70
113
systemInfo . AppendLine ( $ ".NET SDK: { GetDotNetSdkVersion ( ) } ") ;
71
114
systemInfo . AppendLine ( $ "GPU: { GetGpuInformation ( ) } ") ;
@@ -91,7 +134,20 @@ private static string GetSystemLanguage()
91
134
try
92
135
{
93
136
var currentCulture = CultureInfo . CurrentUICulture ;
94
- return $ "{ currentCulture . EnglishName } \n Keyboard layout:{ currentCulture . KeyboardLayoutId } ({ currentCulture . Parent } ) ";
137
+ return currentCulture . EnglishName ;
138
+ }
139
+ catch ( Exception )
140
+ {
141
+ return "Unknown" ;
142
+ }
143
+ }
144
+
145
+ private static string GetKeyboardLayout ( )
146
+ {
147
+ try
148
+ {
149
+ var currentInputLanguage = InputLanguage . CurrentInputLanguage ;
150
+ return $ "{ currentInputLanguage . Culture . Name } ";
95
151
}
96
152
catch ( Exception )
97
153
{
@@ -145,23 +201,31 @@ private static string GetDotNetSdkVersion()
145
201
return "Not found" ;
146
202
}
147
203
148
- private static string GetGpuInformation ( )
204
+ private static string GetGpuInformation ( string infoType = "both" )
149
205
{
150
206
var gpuList = new List < string > ( ) ;
207
+ var activeGpu = ProgramWindows . ActiveGpu ;
151
208
152
209
try
153
210
{
154
211
using ( var searcher = new ManagementObjectSearcher ( "SELECT * FROM Win32_VideoController" ) )
155
212
{
156
-
157
- foreach ( var searchResult in searcher . Get ( ) )
213
+ foreach ( ManagementObject obj in searcher . Get ( ) )
158
214
{
159
- if ( searchResult is not ManagementObject obj )
160
- continue ;
161
215
162
216
var name = obj [ "Name" ] ? . ToString ( ) ?? "Unknown" ;
217
+ if ( name == activeGpu )
218
+ name += " (Active)" ;
219
+
163
220
var driverVersion = obj [ "DriverVersion" ] ? . ToString ( ) ?? "Unknown" ;
164
- var gpuDetails = $ "{ name } \n Driver version: { driverVersion } ";
221
+
222
+ string gpuDetails = infoType . ToLower ( ) switch
223
+ {
224
+ "name" => name ,
225
+ "driver" => driverVersion ,
226
+ _ => $ "{ name } \n Driver version: { driverVersion } " // Default/both case
227
+ } ;
228
+
165
229
gpuList . Add ( gpuDetails ) ;
166
230
}
167
231
}
@@ -175,8 +239,58 @@ private static string GetGpuInformation()
175
239
176
240
return "Unknown" ;
177
241
}
178
-
242
+
243
+ private static string GetIdeName ( )
244
+ {
245
+ try
246
+ {
247
+ // Get the current process
248
+ var currentProcess = Process . GetCurrentProcess ( ) ;
249
+
250
+ // Use WMI to find the parent process
251
+ var query = $ "SELECT ParentProcessId FROM Win32_Process WHERE ProcessId = { currentProcess . Id } ";
252
+ using var searcher = new ManagementObjectSearcher ( query ) ;
253
+ var result = searcher . Get ( ) . Cast < ManagementObject > ( ) . FirstOrDefault ( ) ;
254
+
255
+ if ( result != null )
256
+ {
257
+ var parentProcessId = Convert . ToInt32 ( result [ "ParentProcessId" ] ) ;
258
+ using var parentProcess = Process . GetProcessById ( parentProcessId ) ;
259
+ var processName = parentProcess . ProcessName . ToLower ( ) ;
260
+
261
+ // Map common IDE process names to user-friendly names
262
+ return processName switch
263
+ {
264
+ "devenv" => "Visual Studio" ,
265
+ "vsdebugconsole" => "Visual Studio" ,
266
+ "rider64" => "JetBrains Rider" ,
267
+ "vshost" => "Visual Studio (Debug Host)" ,
268
+ "msvsmon" => "Visual Studio Remote Debugger" ,
269
+ _ => parentProcess . ProcessName // Fallback to the raw process name
270
+ } ;
271
+ }
272
+ }
273
+ catch ( Exception e )
274
+ {
275
+ Log . Warning ( $ "Failed to get IDE name: { e . Message } ") ;
276
+ }
277
+
278
+ return "Unknown" ;
279
+ }
280
+ private static readonly string ideName = GetIdeName ( ) ;
281
+ private static readonly string appLanguage = GetAppLanguage ( ) ;
282
+ private static readonly string dateTime = DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) ;
283
+
284
+ private static readonly string operatingSystemInfo = GetOperatingSystemInfo ( ) ;
285
+ private static readonly string systemLanguage = GetSystemLanguage ( ) ;
286
+ private static readonly string keyboardLayout = GetKeyboardLayout ( ) ;
287
+ private static readonly string dotNetRuntime = GetDotNetRuntimeVersion ( ) ;
288
+ private static readonly string dotNetSdk = GetDotNetSdkVersion ( ) ;
289
+ private static readonly string gpuInformation = GetGpuInformation ( ) ;
290
+
179
291
private string _systemInfo = string . Empty ;
180
292
293
+ private static readonly Vector2 mySpacing = new ( 6.0f , 3.0f ) ;
294
+
181
295
182
296
}
0 commit comments