Add Remote Desktop screen selector + new-tab button (v2.2.0)
- CaptureModeRunner: screen index param (0=all, 1-N=specific monitor) - RtcService: reads screen from rdp_start JSON, passes to capture helper - Program.cs: parses optional screen index arg for --rdp-capture - RemoteDesktopPanel: screen dropdown (Alle/1-4), new-tab button - RdpPage: fullscreen standalone page at /rdp/:agentId - AgentDetailPage: removed dead _RemoteDesktopOld_unused code Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ public static class CaptureModeRunner
|
||||
private static readonly ImageCodecInfo JpegCodec =
|
||||
ImageCodecInfo.GetImageEncoders().First(c => c.FormatID == ImageFormat.Jpeg.Guid);
|
||||
|
||||
public static void Run(string portStr)
|
||||
public static void Run(string portStr, int screenIdx = 0)
|
||||
{
|
||||
if (!int.TryParse(portStr, out var port) || port <= 0) return;
|
||||
|
||||
@@ -24,22 +24,29 @@ public static class CaptureModeRunner
|
||||
var encParams = new EncoderParameters(1);
|
||||
encParams.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 60L);
|
||||
|
||||
// Alle Screens zusammenführen (Multi-Monitor-Support)
|
||||
// Capture-Region bestimmen: 0 = alle Screens, 1-N = spezifischer Screen
|
||||
var allScreens = System.Windows.Forms.Screen.AllScreens;
|
||||
int left = allScreens.Min(s => s.Bounds.X);
|
||||
int top = allScreens.Min(s => s.Bounds.Y);
|
||||
int right = allScreens.Max(s => s.Bounds.X + s.Bounds.Width);
|
||||
int bottom = allScreens.Max(s => s.Bounds.Y + s.Bounds.Height);
|
||||
int totalW = right - left;
|
||||
int totalH = bottom - top;
|
||||
Rectangle captureRect;
|
||||
if (screenIdx <= 0 || screenIdx > allScreens.Length)
|
||||
{
|
||||
int left = allScreens.Min(s => s.Bounds.X);
|
||||
int top = allScreens.Min(s => s.Bounds.Y);
|
||||
int right = allScreens.Max(s => s.Bounds.X + s.Bounds.Width);
|
||||
int bottom = allScreens.Max(s => s.Bounds.Y + s.Bounds.Height);
|
||||
captureRect = new Rectangle(left, top, right - left, bottom - top);
|
||||
}
|
||||
else
|
||||
{
|
||||
captureRect = allScreens[screenIdx - 1].Bounds;
|
||||
}
|
||||
|
||||
while (tcp.Connected)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var bmp = new Bitmap(totalW, totalH, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
using var bmp = new Bitmap(captureRect.Width, captureRect.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
using (var g = Graphics.FromImage(bmp))
|
||||
g.CopyFromScreen(left, top, 0, 0, new Size(totalW, totalH));
|
||||
g.CopyFromScreen(captureRect.X, captureRect.Y, 0, 0, new Size(captureRect.Width, captureRect.Height));
|
||||
|
||||
byte[] jpeg;
|
||||
using (var ms = new MemoryStream())
|
||||
|
||||
Reference in New Issue
Block a user