示例#1
0
        private StructureValueCollection _collection;    // The values that have been read so far

        /// <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)
        {
            StructureReader structReader = new StructureReader(reader, layout);

            layout.Accept(structReader);
            return(structReader._collection);
        }
示例#2
0
        private StructureValueCollection _collection;    // The values that are being written

        public static void WriteStructure(StructureValueCollection values, StructureLayout layout, IWriter writer)
        {
            StructureWriter structWriter = new StructureWriter(values, layout, writer);

            layout.Accept(structWriter);
        }