// dnlib: See LICENSE.txt for more info
using System.Diagnostics;
namespace dnlib.IO {
///
/// Base class for classes needing to implement IFileSection
///
[DebuggerDisplay("O:{startOffset} L:{size} {GetType().Name}")]
public class FileSection : IFileSection {
///
/// The start file offset of this section
///
protected FileOffset startOffset;
///
/// Size of the section
///
protected uint size;
///
public FileOffset StartOffset => startOffset;
///
public FileOffset EndOffset => startOffset + size;
///
/// Set to 's current position
///
/// The reader
protected void SetStartOffset(ref DataReader reader) =>
startOffset = (FileOffset)reader.CurrentOffset;
///
/// Set according to 's current position
///
/// The reader
protected void SetEndoffset(ref DataReader reader) =>
size = reader.CurrentOffset - (uint)startOffset;
}
}