Example #1
0
        /// <summary>
        ///    Renders the current instance as a raw ASF object.
        /// </summary>
        /// <returns>
        ///    A <see cref="ByteVector" /> object containing the
        ///    rendered version of the current instance.
        /// </returns>
        public override ByteVector Render()
        {
            ByteVector output      = new ByteVector();
            uint       child_count = 0;

            foreach (Object child in children)
            {
                if (child.Guid != Asf.Guid.AsfPaddingObject)
                {
                    output.Add(child.Render());
                    child_count++;
                }
            }

            long size_diff = (long)output.Count + 30 -
                             (long)OriginalSize;

            if (size_diff != 0)
            {
                PaddingObject obj = new PaddingObject((uint)
                                                      (size_diff > 0 ? 4096 : -size_diff));

                output.Add(obj.Render());
                child_count++;
            }

            output.Insert(0, reserved);
            output.Insert(0, RenderDWord(child_count));
            return(Render(output));
        }
		/// <summary>
		///    Renders the current instance as a raw ASF object.
		/// </summary>
		/// <returns>
		///    A <see cref="ByteVector" /> object containing the
		///    rendered version of the current instance.
		/// </returns>
		public override ByteVector Render ()
		{
			ByteVector output = new ByteVector ();
			uint child_count = 0;
			
			foreach (Object child in children)
				if (child.Guid != Asf.Guid.AsfPaddingObject) {
					output.Add (child.Render ());
					child_count ++;
				}
			
			long size_diff = (long) output.Count + 30 -
				(long) OriginalSize;
			
			if (size_diff != 0) {
				PaddingObject obj = new PaddingObject ((uint)
					(size_diff > 0 ? 4096 : - size_diff));
				
				output.Add (obj.Render ());
				child_count ++;
			}
			
			output.Insert (0, reserved);
			output.Insert (0, RenderDWord (child_count));
			return Render (output);
		}