Exemplo n.º 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"));
            }
        }
Exemplo n.º 2
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"));
            }
        }