예제 #1
0
        private IASValue ReadArray()
        {
            int length = input.ReadInt();

            if (length < 0)
            {
                throw new AMFException(ExceptionPrefix + "Encountered negative Array length.");
            }

            // Important: Add the array to the cache before deserializing its properties!
            ASArray result = ASArray.CreateUninitializedInstance();

            AddObjectToCache(result);

            IASValue[] indexedValues;

            // Read indexed values, if any.
            if (length != 0)
            {
                indexedValues = new IASValue[length];
                for (int i = 0; i < length; i++)
                {
                    indexedValues[i] = ReadObject();
                }
            }
            else
            {
                indexedValues = EmptyArray <IASValue> .Instance;
            }

            result.SetProperties(indexedValues, EmptyDictionary <string, IASValue> .Instance);
            return(result);
        }
예제 #2
0
        /// <summary>
        /// Reads an AMF body from an input stream.
        /// </summary>
        /// <param name="input">The input stream</param>
        /// <returns>The AMF body that was read</returns>
        private static AMFBody ReadAMFBody(AMFDataInput input)
        {
            string requestTarget  = input.ReadShortString();
            string responseTarget = input.ReadShortString();
            int    bodyLength     = input.ReadInt();

            IASValue content = ReadAMFContent(input, bodyLength);

            return(new AMFBody(requestTarget, responseTarget, content));
        }
예제 #3
0
        /// <summary>
        /// Reads an AMF header from an input stream.
        /// </summary>
        /// <param name="input">The input stream</param>
        /// <returns>The AMF header that was read</returns>
        private static AMFHeader ReadAMFHeader(AMFDataInput input)
        {
            string name           = input.ReadShortString();
            bool   mustUnderstand = input.ReadBoolean();
            int    headerLength   = input.ReadInt();

            IASValue content = ReadAMFContent(input, headerLength);

            return(new AMFHeader(name, mustUnderstand, content));
        }
예제 #4
0
        /// <summary>
        /// Reads an AMF header from an input stream.
        /// </summary>
        /// <param name="input">The input stream</param>
        /// <returns>The AMF header that was read</returns>
        private static AMFHeader ReadAMFHeader(AMFDataInput input)
        {
            string name = input.ReadShortString();
            bool mustUnderstand = input.ReadBoolean();
            int headerLength = input.ReadInt();

            IASValue content = ReadAMFContent(input, headerLength);

            return new AMFHeader(name, mustUnderstand, content);
        }
예제 #5
0
        /// <summary>
        /// Reads an AMF body from an input stream.
        /// </summary>
        /// <param name="input">The input stream</param>
        /// <returns>The AMF body that was read</returns>
        private static AMFBody ReadAMFBody(AMFDataInput input)
        {
            string requestTarget = input.ReadShortString();
            string responseTarget = input.ReadShortString();
            int bodyLength = input.ReadInt();

            IASValue content = ReadAMFContent(input, bodyLength);

            return new AMFBody(requestTarget, responseTarget, content);
        }