mirror of
https://github.com/Ylianst/MeshCentralRouter
synced 2025-12-15 07:43:38 +00:00
Added jumbo command processing for remote desktop.
This commit is contained in:
@@ -66,6 +66,7 @@ namespace MeshCentralRouter
|
|||||||
InitTouch = 14,
|
InitTouch = 14,
|
||||||
Touch = 15,
|
Touch = 15,
|
||||||
Message = 16,
|
Message = 16,
|
||||||
|
Jumbo = 27,
|
||||||
Disconnect = 59,
|
Disconnect = 59,
|
||||||
Alert = 65,
|
Alert = 65,
|
||||||
MouseCursor = 88
|
MouseCursor = 88
|
||||||
@@ -124,13 +125,26 @@ namespace MeshCentralRouter
|
|||||||
|
|
||||||
public int ProcessData(byte[] buffer, int off, int len)
|
public int ProcessData(byte[] buffer, int off, int len)
|
||||||
{
|
{
|
||||||
|
int jumboHeaderSize = 0;
|
||||||
|
|
||||||
if (len == 0) return 0;
|
if (len == 0) return 0;
|
||||||
if (len >= 4)
|
if (len >= 4)
|
||||||
{
|
{
|
||||||
|
// Decode the command header
|
||||||
KvmCommands btype = (KvmCommands)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(buffer, off));
|
KvmCommands btype = (KvmCommands)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(buffer, off));
|
||||||
ushort blen = (ushort)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(buffer, off + 2));
|
int blen = (int)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(buffer, off + 2));
|
||||||
if (len < blen) return 0;
|
if (len < blen) return 0;
|
||||||
|
|
||||||
|
// Handle JUMBO command
|
||||||
|
if ((btype == KvmCommands.Jumbo) && (blen == 8))
|
||||||
|
{
|
||||||
|
jumboHeaderSize = 8;
|
||||||
|
blen = (int)IPAddress.NetworkToHostOrder((int)BitConverter.ToUInt32(buffer, off + 4));
|
||||||
|
off += 8;
|
||||||
|
btype = (KvmCommands)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(buffer, off));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process the command
|
||||||
switch (btype)
|
switch (btype)
|
||||||
{
|
{
|
||||||
case KvmCommands.Screen:
|
case KvmCommands.Screen:
|
||||||
@@ -149,7 +163,7 @@ namespace MeshCentralRouter
|
|||||||
SendMouse(2, KvmMouseButtonCommands.MOUSEEVENTF_LEFTUP);
|
SendMouse(2, KvmMouseButtonCommands.MOUSEEVENTF_LEFTUP);
|
||||||
SendMouse(2, KvmMouseButtonCommands.MOUSEEVENTF_MIDDLEUP);
|
SendMouse(2, KvmMouseButtonCommands.MOUSEEVENTF_MIDDLEUP);
|
||||||
SendMouse(2, KvmMouseButtonCommands.MOUSEEVENTF_RIGHTUP);
|
SendMouse(2, KvmMouseButtonCommands.MOUSEEVENTF_RIGHTUP);
|
||||||
return blen;
|
return blen + jumboHeaderSize;
|
||||||
}
|
}
|
||||||
case KvmCommands.Picture:
|
case KvmCommands.Picture:
|
||||||
{
|
{
|
||||||
@@ -176,7 +190,7 @@ namespace MeshCentralRouter
|
|||||||
if (scalefactor == 1) Invalidate(r, false); else Invalidate(r3, false);
|
if (scalefactor == 1) Invalidate(r, false); else Invalidate(r3, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return blen;
|
return blen + jumboHeaderSize;
|
||||||
}
|
}
|
||||||
case KvmCommands.Copy:
|
case KvmCommands.Copy:
|
||||||
{
|
{
|
||||||
@@ -207,7 +221,7 @@ namespace MeshCentralRouter
|
|||||||
tilecopy++;
|
tilecopy++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return blen;
|
return blen + jumboHeaderSize;
|
||||||
}
|
}
|
||||||
case KvmCommands.GetDisplays:
|
case KvmCommands.GetDisplays:
|
||||||
{
|
{
|
||||||
@@ -251,7 +265,7 @@ namespace MeshCentralRouter
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return blen;
|
return blen + jumboHeaderSize;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user