It can actually take screenshots of the VM

This commit is contained in:
2026-02-09 14:26:11 +01:00
parent c4223d45e4
commit 9a333bb1c8
7 changed files with 364 additions and 14 deletions

View File

@@ -84,13 +84,21 @@ namespace RemoteFrameBuffer
throw new Exception("Cannot parse protocol version");
}
RfbProtoVersion serverVersion = new(Int16.Parse(m.Groups["major"].Value), Int16.Parse(m.Groups["minor"].Value));
RfbProtoVersion maxProto = _protocolHandlers.Keys.Where((ph) => ph <= serverVersion).Max();
RfbProtoVersion[] supportedProto = _protocolHandlers.Keys.Where((ph) => ph <= serverVersion).ToArray();
if (supportedProto.Length == 0)
{
throw new NotSupportedException("No common protocol between client and server");
}
RfbProtoVersion maxProto = supportedProto.Max();
RemoteFrameBufferClientProtocol proto = _protocolHandlers[maxProto].Construct(s);
Console.Error.WriteLine($"Using client protocol {proto.Version.Major}.{proto.Version.Minor}");
proto.Handshake();
proto.Initialization();
// TODO: register auth callback and the like
proto.Handshake(this.cancellationTokenSource.Token);
proto.Initialization(this.cancellationTokenSource.Token);
proto.StartListener(this.cancellationTokenSource.Token).Wait();
}
#warning REMOVE THIS
return;
}
}