Пример #1
0
        /// <summary>
        /// Parse the message.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the message.</param>
        /// <param name="index">Index of the first byte of the message  in the MPEG2 section.</param>
        /// <param name="objectInfoLength">The length of the object information data.</param>
        public override void Process(byte[] byteData, int index, int objectInfoLength)
        {
            lastIndex = index;

            try
            {
                if (objectInfoLength > 0)
                {
                    objectInfoData = Utils.GetBytes(byteData, lastIndex, objectInfoLength);
                    lastIndex     += objectInfoLength;
                }

                serviceContextCount = (int)byteData[lastIndex];
                lastIndex++;

                if (serviceContextCount != 0)
                {
                    serviceContexts = new Collection <BIOPServiceContext>();

                    while (serviceContexts.Count != serviceContextCount)
                    {
                        BIOPServiceContext serviceContext = new BIOPServiceContext();
                        serviceContext.Process(byteData, lastIndex);
                        serviceContexts.Add(serviceContext);

                        lastIndex = serviceContext.Index;
                    }
                }

                messageBodyLength = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex        += 4;

                bindingsCount = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex    += 2;

                if (bindingsCount != 0)
                {
                    bindings = new Collection <BIOPBinding>();

                    while (bindings.Count != bindingsCount)
                    {
                        BIOPBinding binding = new BIOPBinding();
                        binding.Process(byteData, lastIndex);
                        bindings.Add(binding);

                        lastIndex = binding.Index;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP Directory message is short"));
            }
        }
Пример #2
0
        /// <summary>
        /// Parse the message.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the message.</param>
        /// <param name="index">Index of the first byte of the message  in the MPEG2 section.</param>
        /// <param name="objectInfoLength">The length of the object information data.</param>
        public override void Process(byte[] byteData, int index, int objectInfoLength)
        {
            lastIndex = index;

            try
            {
                if (objectInfoLength > 0)
                {
                    objectInfoData = Utils.GetBytes(byteData, lastIndex, objectInfoLength);
                    lastIndex += objectInfoLength;
                }

                serviceContextCount = (int)byteData[lastIndex];
                lastIndex++;

                if (serviceContextCount != 0)
                {
                    serviceContexts = new Collection<BIOPServiceContext>();

                    while (serviceContexts.Count != serviceContextCount)
                    {
                        BIOPServiceContext serviceContext = new BIOPServiceContext();
                        serviceContext.Process(byteData, lastIndex);
                        serviceContexts.Add(serviceContext);

                        lastIndex = serviceContext.Index;
                    }
                }

                messageBodyLength = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex += 4;

                bindingsCount = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex += 2;

                if (bindingsCount != 0)
                {
                    bindings = new Collection<BIOPBinding>();

                    while (bindings.Count != bindingsCount)
                    {
                        BIOPBinding binding = new BIOPBinding();
                        binding.Process(byteData, lastIndex);
                        bindings.Add(binding);

                        lastIndex = binding.Index;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP Directory message is short"));
            }
        }
Пример #3
0
        /// <summary>
        /// Parse the gateway information.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the gateway information.</param>
        /// <param name="index">Index of the byte in the MPEG2 section following the gateway information.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                iopIor = new IOPIOR();
                iopIor.Process(byteData, lastIndex);
                lastIndex = iopIor.Index;

                tapsCount = (int)byteData[lastIndex];
                lastIndex++;

                if (tapsCount != 0)
                {
                    taps = new Collection<BIOPTap>();

                    while (taps.Count < tapsCount)
                    {
                        BIOPTap tap = new BIOPTap();
                        tap.Process(byteData, lastIndex);
                        taps.Add(tap);

                        lastIndex = tap.Index;
                    }
                }

                serviceContextCount = (int)byteData[lastIndex];
                lastIndex++;

                if (serviceContextCount != 0)
                {
                    serviceContexts = new Collection<BIOPServiceContext>();

                    while (serviceContexts.Count < serviceContextCount)
                    {
                        BIOPServiceContext serviceContext = new BIOPServiceContext();
                        serviceContext.Process(byteData, lastIndex);
                        serviceContexts.Add(serviceContext);

                        lastIndex = serviceContext.Index;
                    }
                }

                userInfoLength = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex += 2;

                if (userInfoLength != 0)
                {
                    userInfo = Utils.GetBytes(byteData, lastIndex, userInfoLength);
                    lastIndex += userInfoLength;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The Service Gateway Info message is short"));
            }
        }
Пример #4
0
        /// <summary>
        /// Parse the message.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the message.</param>
        /// <param name="index">Index of the first byte of the message in the MPEG2 section.</param>
        /// <param name="objectInfoLength">The length of the object information data.</param>
        public override void Process(byte[] byteData, int index, int objectInfoLength)
        {
            lastIndex = index;

            try
            {
                if (objectInfoLength != 0)
                {
                    fileContentSize = Utils.Convert8BytesToLong(byteData, lastIndex);
                    lastIndex      += 8;

                    if (objectInfoLength > 8)
                    {
                        contentTypeDescriptors = new Collection <MHPContentTypeDescriptor>();

                        int workingLength = objectInfoLength - 8;

                        while (workingLength != 0)
                        {
                            MHPContentTypeDescriptor descriptor = new MHPContentTypeDescriptor();
                            descriptor.Process(byteData, lastIndex);
                            contentTypeDescriptors.Add(descriptor);

                            workingLength = descriptor.Index - lastIndex;
                            lastIndex     = descriptor.Index;
                        }
                    }
                }

                serviceContextCount = (int)byteData[lastIndex];
                lastIndex++;

                if (serviceContextCount != 0)
                {
                    serviceContexts = new Collection <BIOPServiceContext>();

                    while (serviceContexts.Count != serviceContextCount)
                    {
                        BIOPServiceContext serviceContext = new BIOPServiceContext();
                        serviceContext.Process(byteData, lastIndex);
                        serviceContexts.Add(serviceContext);

                        lastIndex = serviceContext.Index;
                    }
                }

                messageBodyLength = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex        += 4;

                contentLength = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex    += 4;

                if (contentLength != 0)
                {
                    contentData = Utils.GetBytes(byteData, lastIndex, contentLength);
                    lastIndex  += contentLength;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP File message is short"));
            }
        }
Пример #5
0
        /// <summary>
        /// Parse the message.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the message.</param>
        /// <param name="index">Index of the first byte of the message in the MPEG2 section.</param>
        /// <param name="objectInfoLength">The length of the object information data.</param>
        public override void Process(byte[] byteData, int index, int objectInfoLength)
        {
            lastIndex = index;

            try
            {
                if (objectInfoLength != 0)
                {
                    fileContentSize = Utils.Convert8BytesToLong(byteData, lastIndex);
                    lastIndex += 8;

                    if (objectInfoLength > 8)
                    {
                        contentTypeDescriptors = new Collection<MHPContentTypeDescriptor>();

                        int workingLength = objectInfoLength - 8;

                        while (workingLength != 0)
                        {
                            MHPContentTypeDescriptor descriptor = new MHPContentTypeDescriptor();
                            descriptor.Process(byteData, lastIndex);
                            contentTypeDescriptors.Add(descriptor);

                            workingLength = descriptor.Index - lastIndex;
                            lastIndex = descriptor.Index;

                        }
                    }
                }

                serviceContextCount = (int)byteData[lastIndex];
                lastIndex++;

                if (serviceContextCount != 0)
                {
                    serviceContexts = new Collection<BIOPServiceContext>();

                    while (serviceContexts.Count != serviceContextCount)
                    {
                        BIOPServiceContext serviceContext = new BIOPServiceContext();
                        serviceContext.Process(byteData, lastIndex);
                        serviceContexts.Add(serviceContext);

                        lastIndex = serviceContext.Index;
                    }
                }

                messageBodyLength = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex += 4;

                contentLength = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex += 4;

                if (contentLength != 0)
                {
                    contentData = Utils.GetBytes(byteData, lastIndex, contentLength);
                    lastIndex += contentLength;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP File message is short"));
            }
        }