public bool FindPrev(out HookILCursor[] cursors, params Func <Instruction, bool>[] predicates) { cursors = new HookILCursor[predicates.Length]; Instruction instrOrig = Instr; try { Func <Instruction, bool> last = predicates[predicates.Length - 1]; while (GotoPrev(last)) { cursors[predicates.Length - 1] = Clone(); Instruction instrLast = Instr; for (int i = predicates.Length - 2; i > -1; i--) { if (!GotoPrev(predicates[i])) { goto Skip; } cursors[i] = Clone(); } Instr = instrLast; return(true); Skip: Instr = instrLast; continue; } } catch { // Fail silently. } Instr = instrOrig; return(false); }
public bool FindNext(out HookILCursor[] cursors, params Func <Instruction, bool>[] predicates) { cursors = new HookILCursor[predicates.Length]; Instruction instrOrig = Instr; try { Func <Instruction, bool> first = predicates[0]; while (GotoNext(first)) { cursors[0] = Clone(); Instruction instrFirst = Instr; for (int i = 1; i < predicates.Length; i++) { if (!GotoNext(predicates[i])) { goto Skip; } cursors[i] = Clone(); } Instr = instrFirst; return(true); Skip: Instr = instrFirst; continue; } } catch { // Fail silently. } Instr = instrOrig; return(false); }
public HookILCursor(HookILCursor old) { HookIL = old.HookIL; Instr = old.Instr; }