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

            try
            {
                nameCount = (int)byteData[lastIndex];
                lastIndex++;

                if (nameCount != 0)
                {
                    names = new Collection <BIOPName>();

                    while (names.Count != nameCount)
                    {
                        BIOPName name = new BIOPName();
                        name.Process(byteData, lastIndex);
                        names.Add(name);

                        lastIndex = name.Index;
                    }
                }

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

                iopIOR = new IOPIOR();
                iopIOR.Process(byteData, lastIndex);
                lastIndex = iopIOR.Index;

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

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

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP Binding message is short"));
            }
        }
Пример #2
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"));
            }
        }
Пример #3
0
        /// <summary>
        /// Parse the binding.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the descriptor.</param>
        /// <param name="index">Index of the first byte of the binding in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                nameCount = (int)byteData[lastIndex];
                lastIndex++;

                if (nameCount != 0)
                {
                    names = new Collection<BIOPName>();

                    while (names.Count != nameCount)
                    {
                        BIOPName name = new BIOPName();
                        name.Process(byteData, lastIndex);
                        names.Add(name);

                        lastIndex = name.Index;
                    }
                }

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

                iopIOR = new IOPIOR();
                iopIOR.Process(byteData, lastIndex);
                lastIndex = iopIOR.Index;

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

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

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