Пример #1
0
        /// <summary>
        /// Peek ahead bytes but do not chnage the seek pointer in sequential access
        /// </summary>
        /// <param name="position">The position in the file at which to begin reading
        /// relative to the current position in the file. Default is 0</param>
        /// <param name="count">The number of bytes to read. Default 1.</param>
        /// <returns>A byte array</returns>
        public LayoutModel <TLayoutType> PeekStructure <TLayoutType>(int count = 1, long position = 0)
            where TLayoutType : struct
        {
            LayoutModel <TLayoutType> model = new LayoutModel <TLayoutType>();

            using (MemoryMappedViewStream tempPeek = this.MemoryFile.CreateViewStream(position,
                                                                                      count, MemoryMappedFileAccess.Read))
            {
                MemorySequentialAccess.ReadLayoutHelper(tempPeek, model, position);
            }

            return(model);
        }
Пример #2
0
 /// <summary>
 /// Read a layout model
 /// </summary>
 /// <typeparam name="TLayoutType">The Layout Model value Type</typeparam>
 /// <param name="position">The position in the file at which to begin reading
 /// relative to the current position in the file. Default is 0</param>
 /// <param name="model">The structure to contain the read data</param>
 public void ReadLayout <TLayoutType>(LayoutModel <TLayoutType> model, long position = 0)
     where TLayoutType : struct
 {
     MemorySequentialAccess.ReadLayoutHelper(this.IoAccess, model, position);
 }