EncodeString() public static method

Decodes a sequence of bytes from the specified char array into a string.
public static EncodeString ( char chars, int offset, int count ) : byte[]
chars char /// The array containing the sequence of bytes to decode. ///
offset int /// The index of the first byte to decode. ///
count int /// The number of bytes to decode. ///
return byte[]
Exemplo n.º 1
0
        /// <summary>
        /// Calculates a response for a password challenge, using a password.
        /// </summary>
        /// <param name="challenge">
        /// The challenge received from the server.
        /// </param>
        /// <param name="password">
        /// The password to encrypt the challenge with.
        /// </param>
        /// <param name="response">
        /// The response to send back to the server.
        /// </param>
        public static void GetChallengeResponse(byte[] challenge, char[] password, byte[] response)
        {
            Throw.If.Null(password, "password");

            var passwordBytes = VncStream.EncodeString(password, 0, password.Length);

            using (new Utility.AutoClear(passwordBytes))
            {
                GetChallengeResponse(challenge, passwordBytes, response);
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public virtual void GetChallengeResponse(byte[] challenge, char[] password, byte[] response)
        {
            if (password == null)
            {
                throw new ArgumentNullException(nameof(password));
            }

            var passwordBytes = VncStream.EncodeString(password, 0, password.Length);

            using (new Utility.AutoClear(passwordBytes))
            {
                this.GetChallengeResponse(challenge, passwordBytes, response);
            }
        }
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)
        {
            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.º 4
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);
            }
        }