Small fix for RDP

moved static field to property so command handler gets the initial -1
check starting rdp
This commit is contained in:
d3agle 2015-04-06 12:20:00 -05:00
parent ee19378725
commit f624028755
2 changed files with 7 additions and 5 deletions

View File

@ -14,7 +14,6 @@ namespace xServer.Core.Commands
public static class CommandHandler
{
private const string DELIMITER = "$E$";
private static int lastQuality = -1;
public static void HandleInitialize(Client client, Initialize packet)
{
@ -117,8 +116,8 @@ public static void HandleRemoteDesktopResponse(Client client, DesktopResponse pa
if (client.Value.LastDesktop == null)
{
client.Value.StreamCodec = new UnsafeStreamCodec();
if (lastQuality < 0)
lastQuality = packet.Quality;
if (client.Value.LastQuality < 0)
client.Value.LastQuality = packet.Quality;
using (MemoryStream ms = new MemoryStream(packet.Image))
{
@ -144,10 +143,10 @@ public static void HandleRemoteDesktopResponse(Client client, DesktopResponse pa
{
lock (client.Value.StreamCodec)
{
if (lastQuality != packet.Quality)
if (client.Value.LastQuality != packet.Quality)
{
client.Value.StreamCodec = new UnsafeStreamCodec();
lastQuality = packet.Quality;
client.Value.LastQuality = packet.Quality;
}
Bitmap newScreen = client.Value.StreamCodec.DecodeData(ms);

View File

@ -27,6 +27,8 @@ public class UserState
public bool LastDesktopSeen { get; set; }
public bool LastDirectorySeen { get; set; }
public int LastQuality { get; set; }
public Bitmap LastDesktop { get; set; }
public UnsafeStreamCodec StreamCodec { get; set; }
@ -36,6 +38,7 @@ public UserState()
IsAuthenticated = false;
LastDesktopSeen = true;
LastDirectorySeen = true;
LastQuality = -1;
}
public void DisposeForms()