示例#1
0
        public static bool MoveCaretTo(DecompilerTextView textView, MethodKey key, uint ilOffset)
        {
            if (textView == null)
            {
                return(false);
            }
            TextLocation location, endLocation;
            var          cm = textView.CodeMappings;

            if (cm == null || !cm.ContainsKey(key))
            {
                return(false);
            }
            if (!cm[key].GetInstructionByTokenAndOffset(ilOffset, out location, out endLocation))
            {
                //TODO: Missing IL ranges
                return(false);
            }
            else
            {
                textView.ScrollAndMoveCaretTo(location.Line, location.Column);
                return(true);
            }
        }
示例#2
0
        public static bool JumpToStatement(MethodDef method, uint ilOffset, DecompilerTextView textView = null)
        {
            if (method == null)
            {
                return(false);
            }
            var key = MethodKey.Create(method);

            if (key == null)
            {
                return(false);
            }
            if (textView == null)
            {
                textView = MainWindow.Instance.SafeActiveTextView;
            }
            return(MainWindow.Instance.JumpToReference(textView, method, (success, hasMovedCaret) => {
                if (success)
                {
                    return MoveCaretTo(textView, key.Value, ilOffset);
                }
                return false;
            }));
        }
示例#3
0
 public static bool GoToIL(string asmName, MethodKey key, uint ilOffset, bool newTab)
 {
     return(GoToIL(new SerializedDnModuleWithAssembly(asmName, key.Module), key.Token, ilOffset, newTab));
 }
示例#4
0
 protected MarkedTextLine(MethodKey methodKey, uint ilOffset, IMarkedTextLine senderObj = null)
 {
     this.methodKey = methodKey;
     this.ilOffset  = ilOffset;
     this.senderObj = senderObj ?? this;
 }