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); }
/// <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; }
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); } }
/// <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); }