/// <summary>
 /// Determines the image section the given relative virtual address (RVA) is located at.
 /// </summary>
 /// <param name="rva">The relative virtual address to check.</param>
 /// <returns>The section the <paramref name="rva"/> is located.</returns>
 public ImageSectionHeader GetSectionHeaderByRva(long rva)
 {
     return
         (SectionHeaders.FirstOrDefault(
              sectionHeader =>
              rva >= sectionHeader.VirtualAddress &&
              rva < sectionHeader.VirtualAddress + sectionHeader.VirtualSize));
 }
 /// <summary>
 /// Determines the image section the given absolute file offset is located at.
 /// </summary>
 /// <param name="fileOffset">The absolute file offset to check.</param>
 /// <returns>The section the <paramref name="fileOffset"/> is located.</returns>
 public ImageSectionHeader GetSectionHeaderByFileOffset(long fileOffset)
 {
     return
         (SectionHeaders.FirstOrDefault(
              sectionHeader =>
              fileOffset >= sectionHeader.PointerToRawData &&
              fileOffset < sectionHeader.PointerToRawData + sectionHeader.SizeOfRawData));
 }
        public ImageSection GetSectionByName(string name)
        {
            var header = SectionHeaders.FirstOrDefault(x => x.Name == name);

            return(header != null ? header.Section : null);
        }