Example #1
0
        public void SetData(ByteVector type, AppleDataBox[] boxes)
        {
            type = FixId(type);
            bool added = false;

            foreach (Box box in ilst_box.Children)
            {
                if (type == box.BoxType)
                {
                    box.ClearChildren();
                    if (added)
                    {
                        continue;
                    }
                    added = true;
                    foreach (AppleDataBox b in boxes)
                    {
                        box.AddChild(b);
                    }
                }
            }
            if (added)
            {
                return;
            }
            Box box2 = new AppleAnnotationBox(type);

            ilst_box.AddChild(box2);
            foreach (AppleDataBox b in boxes)
            {
                box2.AddChild(b);
            }
        }
Example #2
0
        /// <summary>
        ///    Sets the data for a specified box type to a collection of
        ///    boxes.
        /// </summary>
        /// <param name="type">
        ///    A <see cref="ByteVector" /> object containing the type to
        ///    add to the new instance.
        /// </param>
        /// <param name="boxes">
        ///    A <see cref="AppleDataBox[]" /> containing boxes to add
        ///    for the specified type.
        /// </param>
        public void SetData(ByteVector type, AppleDataBox [] boxes)
        {
            // Fix the type.
            type = FixId(type);

            bool added = false;

            foreach (Box box in ilst_box.Children)
            {
                if (type == box.BoxType)
                {
                    // Clear the box's children.
                    box.ClearChildren();

                    // If we've already added new childen,
                    // continue.
                    if (added)
                    {
                        continue;
                    }

                    added = true;

                    // Add the children.
                    foreach (AppleDataBox b in boxes)
                    {
                        box.AddChild(b);
                    }
                }
            }

            if (added)
            {
                return;
            }

            Box box2 = new AppleAnnotationBox(type);

            ilst_box.AddChild(box2);

            foreach (AppleDataBox b in boxes)
            {
                box2.AddChild(b);
            }
        }