-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
73 lines (64 loc) · 2.31 KB
/
Copy pathProgram.cs
File metadata and controls
73 lines (64 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.IO;
using System.Windows.Forms;
namespace UiVisualDebugger;
class Program
{
[STAThread]
static int Main(string[] args)
{
Console.WriteLine("=== Antigravity UI Visual Debugger ===");
if (args.Length == 0)
{
Console.WriteLine("Starting System Tray Resident Mode...");
ApplicationConfiguration.Initialize();
Application.Run(new TrayApplicationContext());
return 0;
}
string command = args[0].ToLowerInvariant();
string targetProcess = args.Length > 1 ? args[1] : "PhMeter.WpfApp";
string outputDir = args.Length > 2 ? args[2] : ".";
try
{
switch (command)
{
case "attach":
case "dump":
Console.WriteLine($"[1/2] Attaching to process '{targetProcess}'...");
var (jsonFile, imgFile) = ExternalUiInspector.AttachAndInspect(targetProcess, outputDir);
Console.WriteLine($"[2/2] Success!");
Console.WriteLine($" JSON Dump: {Path.GetFullPath(jsonFile)}");
Console.WriteLine($" Annotated: {Path.GetFullPath(imgFile)}");
return 0;
case "tray":
Console.WriteLine("Starting System Tray Resident Mode...");
ApplicationConfiguration.Initialize();
Application.Run(new TrayApplicationContext());
return 0;
case "help":
default:
PrintUsage();
return 0;
}
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"Error: {ex.Message}");
Console.ResetColor();
return 1;
}
}
static void PrintUsage()
{
Console.WriteLine(@"
Usage:
UiVisualDebugger.exe (Run as System Tray Resident App)
UiVisualDebugger.exe attach <Process_or_PID> [OutputDir]
UiVisualDebugger.exe dump <Process_or_PID> [OutputDir]
Examples:
UiVisualDebugger.exe -> Sits in System Tray with F12 hotkey & auto-watcher
UiVisualDebugger.exe attach PhMeter.WpfApp -> One-shot CLI snapshot dump
");
}
}