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