示例#1
0
        /// <summary>
        /// Gets the full packet data with a big-endian length prepended onto the payload.
        /// </summary>
        /// <returns>The full packet data.</returns>
        public byte[] GetData()
        {
            BinaryWriterEx bb = new BinaryWriterEx( true );

            byte[] payload = this.GetPayload();

            bb.Write( ( uint )payload.Length );
            bb.Write( payload );

            return bb.ToArray();
        }
示例#2
0
        /// <summary>
        /// Gets the full packet data with a big-endian length prepended onto the payload.
        /// </summary>
        /// <returns>The full packet data.</returns>
        public byte[] GetData()
        {
            BinaryWriterEx bb = new BinaryWriterEx(true);

            byte[] payload = this.GetPayload();

            bb.Write(( uint )payload.Length);
            bb.Write(payload);

            return(bb.ToArray());
        }
示例#3
0
        private void PrepareAuthHeader(ref WebClient client, Uri uri)
        {
            reqcounter++;

            byte[] sha_hash;

            BinaryWriterEx bb = new BinaryWriterEx();

            bb.Write( sessionID );
            bb.Write( reqcounter );
            bb.Write( sessionKey );
            bb.Write( Encoding.ASCII.GetBytes( uri.AbsolutePath ) );

            sha_hash = CryptoHelper.SHAHash(bb.ToArray());

            string hex_hash = Utils.EncodeHexString(sha_hash);

            string authheader = String.Format("sessionid={0};req-counter={1};hash={2};", sessionID, reqcounter, hex_hash);

            webClient.Headers.Clear();
            webClient.Headers.Add("x-steam-auth", authheader);
        }