void rvaOffsetBox_Leave(object sender, EventArgs e)
{
try
{
uint rvaOffset = uint.Parse(rvaOffsetBox.Text, NumberStyles.HexNumber);
Section targetSection = Section.GetSectionByRva(assembly, rvaOffset);
OffsetConverter converter;
if (targetSection == null)
{
converter = new OffsetConverter(assembly);
targetSectionLabel.Text = "Target Section: ";
}
else
{
converter = new OffsetConverter(targetSection);
targetSectionLabel.Text = "Target Section: " + targetSection.Name;
}
uint fileOffset = converter.RvaToFileOffset(rvaOffset);
fileOffsetBox.Text = fileOffset.ToString("X8");
vaOffsetBox.Text = converter.RvaToVa(rvaOffset).ToString("X8");
hexBox.Select(fileOffset, 1);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}