TUP.AsmResolver.ASM.InstructionCollection.GetInstructionIndexByVirtualOffset C# (CSharp) Method

GetInstructionIndexByVirtualOffset() public method

Gets the assembly instruction in the application by its virtual offset.
public GetInstructionIndexByVirtualOffset ( ulong TargetOffset ) : int
TargetOffset ulong The Offset of the instruction go get.
return int
        public int GetInstructionIndexByVirtualOffset(ulong TargetOffset)
        {
            x86Instruction TargetInstruction = null;
            foreach (x86Instruction instr in List)
            {
                if (instr.Offset.Va == TargetOffset)
                {
                    TargetInstruction = instr;
                    break;
                }
            }
            if (TargetInstruction == null)
                return -1;

            return List.IndexOf(TargetInstruction);
        }