/// <summary> /// Given a BinaryReader, reads the trace header. /// Assumes that the trace header is the next item to be read. /// </summary> public virtual ITraceHeader ReadTraceHeader(BinaryReader reader, bool isLittleEndian) { var traceHeader = new TraceHeader(); var headerBytes = reader.ReadBytes(_traceHeaderSize); if (headerBytes.Length < _traceHeaderSize) { return(null); } if (headerBytes.Length >= CrosslineNumberLocation + 3) { traceHeader.CrosslineNumber = traceHeader.TraceNumber = ToInt32(headerBytes, CrosslineNumberLocation - 1, isLittleEndian); } if (headerBytes.Length >= InlineNumberLocation + 3) { traceHeader.InlineNumber = ToInt32(headerBytes, InlineNumberLocation - 1, isLittleEndian); } if (headerBytes.Length >= _sampleCountIndex + 2) { traceHeader.SampleCount = ToInt16(headerBytes, _sampleCountIndex, isLittleEndian); } return(traceHeader); }
/// <summary> /// Given a BinaryReader, reads the trace header. /// Assumes that the trace header is the next item to be read. /// </summary> public virtual ITraceHeader ReadTraceHeader(BinaryReader reader, bool isLittleEndian) { var traceHeader = new TraceHeader(); var headerBytes = reader.ReadBytes(_traceHeaderSize); if (headerBytes.Length < _traceHeaderSize) return null; if (headerBytes.Length >= CrosslineNumberLocation + 3) traceHeader.CrosslineNumber = traceHeader.TraceNumber = ToInt32(headerBytes, CrosslineNumberLocation - 1, isLittleEndian); if (headerBytes.Length >= InlineNumberLocation + 3) traceHeader.InlineNumber = ToInt32(headerBytes, InlineNumberLocation - 1, isLittleEndian); if (headerBytes.Length >= _sampleCountIndex + 2) traceHeader.SampleCount = ToInt16(headerBytes, _sampleCountIndex, isLittleEndian); return traceHeader; }
public virtual ITraceHeader ReadTraceHeader(BinaryReader reader) { var traceHeader = new TraceHeader(); var headerBytes = reader.ReadBytes(_traceHeaderSize); if (headerBytes.Length < _traceHeaderSize) return null; if (headerBytes.Length >= CrosslineNumberLocation + 3) traceHeader.CrosslineNumber = traceHeader.TraceNumber = IbmBits.IbmConverter.ToInt32(headerBytes, CrosslineNumberLocation - 1); if (headerBytes.Length >= InlineNumberLocation + 3) traceHeader.InlineNumber = IbmConverter.ToInt32(headerBytes, InlineNumberLocation - 1); if (headerBytes.Length >= _sampleCountIndex + 2) traceHeader.SampleCount = IbmConverter.ToInt16(headerBytes, _sampleCountIndex); return traceHeader; }