EncodeUInt32BE() public static method

Encodes a uint as a byte array in big-endian encoding.
public static EncodeUInt32BE ( uint value ) : byte[]
value uint /// The to encode. ///
return byte[]
Exemplo n.º 1
0
        /// <summary>
        /// 发送一个按键事件到VNC服务器,以指示已按下或释放了键。
        /// </summary>
        /// <param name="keysym">The X11 keysym of the key. 按键对应的 ASCII。</param>
        /// <param name="pressed"><c>true</c> for a key press event, or <c>false</c> for a key release event.</param>
        public void SendKeyEvent(int keysym, bool pressed)
        {
            var p = new byte[8];

            p[0] = (byte)4; p[1] = (byte)(pressed ? 1 : 0);
            VncUtility.EncodeUInt32BE(p, 4, (uint)keysym);

            if (IsConnected)
            {
                _c.Send(p);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Notifies the server that the local clipboard has changed.
        /// If you are implementing clipboard integration, use this to set the remote clipboard.
        /// </summary>
        /// <param name="data">The contents of the local clipboard.</param>
        public void SendLocalClipboardChange(string data)
        {
            Throw.If.Null(data, "data");

            var bytes = VncStream.EncodeString(data);

            var p = new byte[8 + bytes.Length];

            p[0] = (byte)6;
            VncUtility.EncodeUInt32BE(p, 4, (uint)bytes.Length);
            Array.Copy(bytes, 0, p, 8, bytes.Length);

            if (this.IsConnected)
            {
                this.c.Send(p);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Notifies the server that the local clipboard has changed.
        /// If you are implementing clipboard integration, use this to set the remote clipboard.
        /// </summary>
        /// <param name="data">The contents of the local clipboard.</param>
        public void SendLocalClipboardChange(string data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            var bytes = VncStream.EncodeString(data);

            var p = new byte[8 + bytes.Length];

            p[0] = (byte)6;
            VncUtility.EncodeUInt32BE(p, 4, (uint)bytes.Length);
            Array.Copy(bytes, 0, p, 8, bytes.Length);

            if (this.IsConnected)
            {
                this.c.Send(p);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Writes a <see cref="uint"/> in big endian encoding to the current position in the stream and advances the position within the stream by four bytes.
 /// </summary>
 /// <param name="value">
 /// The <see cref="uint"/> to write to the stream.
 /// </param>
 public void SendUInt32BE(uint value)
 {
     this.Send(VncUtility.EncodeUInt32BE(value));
 }