private void SetEncodings() { // We use a stack here. The least favored encoding is pushed onto the stack first. Stack stack = new Stack(); stack.Push(RfbEncoding.Raw); stack.Push(RfbEncoding.CopyRect); stack.Push(RfbEncoding.Rre); // We do support CoRRE encoding. // However, Ultra-VNC server is broken. // If we use CoRRE and server-side scaling is enabled, the server will // send us frame buffer updates with number of rectangles set incorrectly. // So the morale of the story is not to use CoRRE. If we know the server // does not scale the buffer, then we can enable CoRRE. // But this can all be avoided by using Hextile. //stack.Push(RfbEncoding.CoRre); stack.Push(RfbEncoding.Hex); stack.Push(RfbEncoding.NewFBSize); byte[] msg; msg = RfbProtoUtil.GetSetEncodingsMsgHdr((UInt16)stack.Count); WriteBytes(msg, RfbCliMsgType.SetEncodings); RfbEncoding[] encodings = new RfbEncoding[stack.Count]; stack.ToArray().CopyTo(encodings, 0); msg = RfbProtoUtil.GetSetEncodingsMsg(encodings); WriteBytes(msg); }
public RfbRectangleHeader(ushort x, ushort y, ushort width, ushort height, int encoding) { X = x; Y = y; Width = width; Height = height; Encoding = (RfbEncoding)encoding; }
public FrameBufUpdRectMsgHdr(byte[] msg) { rect = new Rectangle(); rect.X = (int)msg[0] << 8 | (int)msg[1]; rect.Y = (int)msg[2] << 8 | (int)msg[3]; rect.Width = (int)msg[4] << 8 | (int)msg[5]; rect.Height = (int)msg[6] << 8 | (int)msg[7]; Encoding = (RfbEncoding)((UInt32)msg[8] << 24 | (UInt32)msg[9] << 16 | (UInt32)msg[10] << 8 | (UInt32)msg[11]); }