using Recordingtest.Player; using Recordingtest.Player.Model; string? scenarioPath = null; string outputDir = Path.Combine(Directory.GetCurrentDirectory(), "player-output"); bool noLaunch = false; for (int i = 0; i < args.Length; i++) { switch (args[i]) { case "--scenario": scenarioPath = args[++i]; break; case "--output-dir": outputDir = args[++i]; break; case "--no-launch": noLaunch = true; break; } } if (scenarioPath is null) { Console.Error.WriteLine("usage: Recordingtest.Player --scenario [--output-dir ] [--no-launch]"); return 2; } Scenario scenario; try { scenario = ScenarioLoader.LoadFromFile(scenarioPath); } catch (Exception ex) { Console.Error.WriteLine($"failed to load scenario: {ex.Message}"); return 3; } var stamp = DateTime.UtcNow.ToString("yyyyMMdd-HHmmss"); var artifactDir = Path.Combine(outputDir, "artifacts", scenario.Name, stamp); Directory.CreateDirectory(artifactDir); FlaUI.Core.Application? app = null; if (noLaunch) { app = UiaPlayerHost.AttachByExeName(scenario.Sut.Exe); if (app is null) { Console.Error.WriteLine($"--no-launch: SUT '{scenario.Sut.Exe}' not running. artifact_dir={artifactDir}"); return 4; } } else { Console.Error.WriteLine("launching SUT is disabled in this PoC sandbox; pass --no-launch."); return 5; } using var host = new UiaPlayerHost(app, artifactDir); var engine = new PlayerEngine(); try { engine.Run(scenario, host); return 0; } catch (Exception ex) { Console.Error.WriteLine($"player failed: {ex.Message} artifact_dir={artifactDir}"); return 1; }