Ejemplo n.º 1
0
        public static void WriteStructure(StructureValueCollection values, StructureLayout layout, IWriter writer)
        {
            var structWriter = new StructureWriter(values, writer);
            layout.Accept(structWriter);

            if (layout.Size > 0)
                structWriter.SeekWriter(layout.Size);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Reads a structure from a stream by following a predefined structure layout.
        /// </summary>
        /// <param name="reader">The IReader to read the structure from.</param>
        /// <param name="layout">The structure layout to follow.</param>
        /// <returns>A collection of the values that were read.</returns>
        /// <seealso cref="StructureLayout" />
        public static StructureValueCollection ReadStructure(IReader reader, StructureLayout layout)
        {
            var structReader = new StructureReader(reader);
            layout.Accept(structReader);
            if (layout.Size > 0)
                structReader.SeekReader(layout.Size);

            return structReader._collection;
        }
Ejemplo n.º 3
0
        public static void WriteStructure(StructureValueCollection values, StructureLayout layout, IWriter writer)
        {
            var structWriter = new StructureWriter(values, writer);

            layout.Accept(structWriter);

            if (layout.Size > 0)
            {
                structWriter.SeekWriter(layout.Size);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Reads a structure from a stream by following a predefined structure layout.
        /// </summary>
        /// <param name="reader">The IReader to read the structure from.</param>
        /// <param name="layout">The structure layout to follow.</param>
        /// <returns>A collection of the values that were read.</returns>
        /// <seealso cref="StructureLayout" />
        public static StructureValueCollection ReadStructure(IReader reader, StructureLayout layout)
        {
            var structReader = new StructureReader(reader);

            layout.Accept(structReader);
            if (layout.Size > 0)
            {
                structReader.SeekReader(layout.Size);
            }

            return(structReader._collection);
        }