Beispiel #1
0
 /// <summary>
 /// Writes element header
 /// </summary>
 /// <param name="elementId"></param>
 /// <param name="size"></param>
 /// <returns></returns>
 public int WriteElementHeader(VInt elementId, VInt size)
 {
     return(elementId.Write(_stream) + size.Write(_stream));
 }
Beispiel #2
0
 /// <summary>
 /// Writes binary data
 /// </summary>
 /// <param name="elementId"></param>
 /// <param name="data"></param>
 /// <returns></returns>
 public int Write(VInt elementId, byte[] data)
 {
     return(Write(elementId, data, 0, data.Length));
 }
Beispiel #3
0
 /// <summary>
 /// Starts nested stream. Upon disposal of nested stream, the size is calculated and written to nested element header.
 /// Example:
 /// using(var data = writer.StartMasterElement(InnerDataElementId))
 /// {
 ///     data.WriteInt(DataItem1Id, 139874)
 ///     data.WriteUtf(DataItem2Id, "Hello world");
 /// }
 /// </summary>
 /// <param name="elementId"></param>
 /// <returns></returns>
 public MasterBlockWriter StartMasterElement(VInt elementId)
 {
     return(new MasterBlockWriter(this, elementId));
 }
Beispiel #4
0
        /// <summary>
        /// Writes datetime value
        /// </summary>
        /// <param name="elementId"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        public int Write(VInt elementId, DateTime dateTime)
        {
            var d = (dateTime - EbmlReader.MilleniumStart).Ticks * 100;

            return(elementId.Write(_stream) + EncodeWidth(8).Write(_stream) + WriteInt(d, 8));
        }