示例#1
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;
        }
示例#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);
        }