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

GetInstructionIndexByOffset() public method

Gets the assembly instruction index by its offset
public GetInstructionIndexByOffset ( long TargetOffset ) : int
TargetOffset long The Offset of the instruction go get.
return int
        public int GetInstructionIndexByOffset(long TargetOffset)
        {
            x86Instruction TargetInstruction = null;
            foreach (x86Instruction instr in List)
            {
                if (instr.Offset.FileOffset == TargetOffset)
                {
                    TargetInstruction = instr;
                    break;
                }
            }
            if (TargetInstruction == null)
                return -1;

            return List.IndexOf(TargetInstruction);
        }