Esempio n. 1
0
        /// <summary>
        /// Reads the server's Initialization message, specifically the remote Framebuffer's properties. See RFB Doc v. 3.8 section 6.1.5.
        /// </summary>
        /// <returns>Returns a Framebuffer object representing the geometry and properties of the remote host.</returns>
        public Framebuffer ReadServerInit(int bitsPerPixel, int depth)
        {
            int w      = Reader.ReadUInt16();
            int h      = Reader.ReadUInt16();
            var buffer = Framebuffer.FromPixelFormat(Reader.ReadBytes(16), w, h, bitsPerPixel, depth);
            var length = (int)Reader.ReadUInt32();

            buffer.DesktopName = GetString(Reader.ReadBytes(length));

            return(buffer);
        }
        /// <summary>
        /// Reads the server's Initialization message, specifically the remote Framebuffer's properties. See RFB Doc v. 3.8 section 6.1.5.
        /// </summary>
        /// <returns>Returns a Framebuffer object representing the geometry and properties of the remote host.</returns>
        public Framebuffer ReadServerInit()
        {
            int         w      = (int)reader.ReadUInt16();
            int         h      = (int)reader.ReadUInt16();
            Framebuffer buffer = Framebuffer.FromPixelFormat(reader.ReadBytes(16), w, h);
            int         length = (int)reader.ReadUInt32();

            buffer.DesktopName = GetString(reader.ReadBytes(length));

            return(buffer);
        }
Esempio n. 3
0
        /// <summary>
        /// Reads the server's Initialization message, specifically the remote Framebuffer's properties. See RFB Doc v. 3.8 section 6.1.5.
        /// </summary>
        /// <returns>Returns a Framebuffer object representing the geometry and properties of the remote host.</returns>
        public async Task <Framebuffer> ReadServerInit(int bitsPerPixel, int depth, CancellationToken ct = default)
        {
            int w = await Reader.ReadUInt16Async(ct).ConfigureAwait(false);

            int h = await Reader.ReadUInt16Async(ct).ConfigureAwait(false);

            var buffer = Framebuffer.FromPixelFormat(await Reader.ReadBytesAsync(16, ct).ConfigureAwait(false), w, h, bitsPerPixel, depth);
            var length = (int)await Reader.ReadUInt32Async(ct).ConfigureAwait(false);

            buffer.DesktopName = GetString(await Reader.ReadBytesAsync(length, ct).ConfigureAwait(false));

            return(buffer);
        }
Esempio n. 4
0
        /// <summary>
        /// Reads the server's Initialization message, specifically the remote Framebuffer's properties. See RFB Doc v. 3.8 section 6.1.5.
        /// </summary>
        /// <returns>Returns a Framebuffer object representing the geometry and properties of the remote host.</returns>
        public Framebuffer ReadServerInit()
        {
            int w = (int)reader.ReadUInt16();
            int h = (int)reader.ReadUInt16();

            byte[] b = reader.ReadBytes(16);
            if (b.Length != 16)
            {
                throw new ArgumentException("Length of b must be 16 bytes, but are " + b.Length + " w=" + w + " h=" + h);
            }

            Framebuffer buffer = Framebuffer.FromPixelFormat(b, w, h);
            int         length = (int)reader.ReadUInt32();

            buffer.DesktopName = GetString(reader.ReadBytes(length));

            return(buffer);
        }