/// <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")); } }
/// <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")); } }