Ejemplo n.º 1
0
        /// <summary>
        /// Decodes a ClientMessage body to user properties and puts them in the constructed object.
        /// </summary>
        /// <param name="message">The ClientMessage to decode the body with user properties of.</param>
        public UserPropertiesDecoder(ClientMessage message)
        {
            if (message == null)
                throw new ArgumentNullException("message");

            mProperties = new Dictionary<int, string>();
            while (message.remainingContent > 0)
            {
                int propID = message.PopInt32();

                if (propID == 10) // Spam me yes/no property
                {
                    // Weird exception on protocol due to Base64 boolean
                    // Skip 7 bytes and ignore this property

                    message.Advance(7);
                    continue;
                }

                string propVal = message.PopFixedString();
                mProperties.Add(propID, propVal);
            }
        }