当前位置: 首页>>代码示例>>C#>>正文


C# DecompilerTextView.ScrollAndMoveCaretTo方法代码示例

本文整理汇总了C#中ICSharpCode.ILSpy.TextView.DecompilerTextView.ScrollAndMoveCaretTo方法的典型用法代码示例。如果您正苦于以下问题:C# DecompilerTextView.ScrollAndMoveCaretTo方法的具体用法?C# DecompilerTextView.ScrollAndMoveCaretTo怎么用?C# DecompilerTextView.ScrollAndMoveCaretTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICSharpCode.ILSpy.TextView.DecompilerTextView的用法示例。


在下文中一共展示了DecompilerTextView.ScrollAndMoveCaretTo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MoveCaretTo

		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;
			}
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:16,代码来源:DebugUtils.cs

示例2: TryShowNextStatement

        bool TryShowNextStatement(DecompilerTextView textView)
        {
            // Always reset the selected frame
            StackFrameManager.Instance.SelectedFrameNumber = 0;

            if (textView == null)
                return false;

            Dictionary<MethodKey, MemberMapping> cm;
            if (!VerifyAndGetCurrentDebuggedMethod(textView, out cm))
                return false;
            var currentKey = currentLocation.Value.MethodKey;

            TextLocation location, endLocation;
            if (!cm[currentKey].GetInstructionByTokenAndOffset(currentLocation.Value.Offset, out location, out endLocation))
                return false;

            textView.ScrollAndMoveCaretTo(location.Line, location.Column);
            return true;
        }
开发者ID:andyhebear,项目名称:dnSpy,代码行数:20,代码来源:DebugManager.cs

示例3: MoveCaretTo

		public static bool MoveCaretTo(DecompilerTextView textView, SerializedDnSpyToken key, uint ilOffset) {
			if (textView == null)
				return false;

			Dictionary<SerializedDnSpyToken, MemberMapping> cm;
			if (!VerifyAndGetCurrentDebuggedMethod(textView, key, out cm))
				return false;

			TextLocation location, endLocation;
			if (!cm[key].GetInstructionByTokenAndOffset(ilOffset, out location, out endLocation))
				return false;

			textView.ScrollAndMoveCaretTo(location.Line, location.Column);
			return true;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:15,代码来源:DebugUtils.cs

示例4: TryShowNextStatement

        static bool TryShowNextStatement(DecompilerTextView textView)
        {
            if (!DebugShowNextStatementCanExecute())
                return false;

            // Always reset the selected frame
            StackFrameStatementManager.SelectedFrame = 0;

            if (textView == null)
                return false;

            Tuple<MethodKey, int, IMemberRef> info;
            MethodKey currentKey;
            Dictionary<MethodKey, MemberMapping> cm;
            if (!DebugUtils.VerifyAndGetCurrentDebuggedMethod(textView, out info, out currentKey, out cm))
                return false;

            NR.TextLocation location, endLocation;
            if (!cm[currentKey].GetInstructionByTokenAndOffset((uint)info.Item2, out location, out endLocation))
                return false;

            textView.ScrollAndMoveCaretTo(location.Line, location.Column);
            return true;
        }
开发者ID:gsong2014,项目名称:dnSpy,代码行数:24,代码来源:DebuggerCommands.cs

示例5: Toggle

 public static void Toggle(DecompilerTextView textView, int line, int column)
 {
     var bps = SourceCodeMappingUtils.Find(textView, line, column);
     var bpms = GetBreakpointBookmarks(textView, bps);
     if (bpms.Count > 0) {
         if (bpms.IsEnabled()) {
             foreach (var bpm in bpms)
                 BookmarkManager.RemoveMark(bpm);
         }
         else {
             foreach (var bpm in bpms)
                 bpm.IsEnabled = true;
         }
     }
     else if (bps.Count > 0) {
         foreach (var bp in bps) {
             if (MethodKey.Create(bp.MemberMapping.MethodDefinition) == null)
                 continue;
             BookmarkManager.AddMark(new BreakpointBookmark(bp.MemberMapping.MethodDefinition, bp.StartLocation, bp.EndLocation, bp.ILInstructionOffset));
         }
         textView.ScrollAndMoveCaretTo(bps[0].StartLocation.Line, bps[0].StartLocation.Column);
     }
 }
开发者ID:4058665,项目名称:dnSpy,代码行数:23,代码来源:BreakpointCommand.cs

示例6: UpdateReturnStatementBookmarks

        /// <summary>
        /// Should be called each time the IL offset has been updated
        /// </summary>
        static bool UpdateReturnStatementBookmarks(DecompilerTextView decompilerTextView, bool moveCaret = false)
        {
            Remove(decompilerTextView);
            bool movedCaret = false;
            var cm = decompilerTextView == null ? null : decompilerTextView.CodeMappings;
            bool updateReturnStatements =
                cm != null &&
                DebuggerService.CurrentDebugger != null &&
                DebuggerService.CurrentDebugger.IsDebugging &&
                !DebuggerService.CurrentDebugger.IsProcessRunning;
            if (updateReturnStatements) {
                int frameNo = -1;
                foreach (var frame in DebuggerService.CurrentDebugger.GetStackFrames(100)) {
                    frameNo++;
                    StackFrameStatementType type;
                    if (frameNo == 0)
                        type = StackFrameStatementType.CurrentStatement;
                    else
                        type = selectedFrame == frameNo ? StackFrameStatementType.SelectedReturnStatement : StackFrameStatementType.ReturnStatement;
                    if (frame.ILOffset == null)
                        continue;
                    var key = frame.MethodKey;
                    int offset = frame.ILOffset.Value;
                    MethodDef methodDef;
                    ICSharpCode.NRefactory.TextLocation location, endLocation;
                    if (cm != null && cm.ContainsKey(key) &&
                        cm[key].GetInstructionByTokenAndOffset((uint)offset, out methodDef, out location, out endLocation)) {
                        var rs = new StackFrameStatementBookmark(decompilerTextView, methodDef, location, endLocation, type, (uint)offset);
                        returnStatementBookmarks.Add(rs);
                        BookmarkManager.AddMark(rs);

                        if (moveCaret && frameNo == selectedFrame) {
                            decompilerTextView.ScrollAndMoveCaretTo(location.Line, location.Column);
                            movedCaret = true;
                        }
                    }
                }
            }
            return movedCaret;
        }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:43,代码来源:StackFrameStatementBookmark.cs

示例7: UpdateStackFrameLines

        /// <summary>
        /// Should be called each time the IL offset has been updated
        /// </summary>
        bool UpdateStackFrameLines(DecompilerTextView decompilerTextView, bool moveCaret = false)
        {
            Remove(decompilerTextView);
            bool movedCaret = false;
            var cm = decompilerTextView == null ? null : decompilerTextView.CodeMappings;
            bool updateReturnStatements = cm != null && DebugManager.Instance.ProcessState == DebuggerProcessState.Stopped;
            if (updateReturnStatements) {
                int frameNo = -1;
                bool tooManyFrames;
                foreach (var frame in GetFrames(MAX_STACKFRAME_LINES, out tooManyFrames)) {
                    frameNo++;
                    if (!frame.IsILFrame)
                        continue;
                    var ip = frame.ILFrameIP;
                    if (!ip.IsExact && !ip.IsApproximate && !ip.IsProlog && !ip.IsEpilog)
                        continue;
                    uint token = frame.Token;
                    if (token == 0)
                        continue;
                    var serAsm = frame.GetSerializedDnModuleWithAssembly();
                    if (serAsm == null)
                        continue;

                    StackFrameLineType type;
                    if (frameNo == 0)
                        type = StackFrameLineType.CurrentStatement;
                    else
                        type = currentState.FrameNumber == frameNo ? StackFrameLineType.SelectedReturnStatement : StackFrameLineType.ReturnStatement;
                    var key = MethodKey.Create(token, serAsm.Value.Module);
                    uint offset = frame.GetILOffset();
                    MethodDef methodDef;
                    TextLocation location, endLocation;
                    if (cm != null && cm.ContainsKey(key) &&
                        cm[key].GetInstructionByTokenAndOffset(offset, out methodDef, out location, out endLocation)) {
                        var rs = new StackFrameLine(type, decompilerTextView, key, offset);
                        stackFrameLines.Add(rs);
                        TextLineObjectManager.Instance.Add(rs);

                        if (moveCaret && frameNo == currentState.FrameNumber) {
                            decompilerTextView.ScrollAndMoveCaretTo(location.Line, location.Column);
                            movedCaret = true;
                        }
                    }
                }
            }
            return movedCaret;
        }
开发者ID:kenwilcox,项目名称:dnSpy,代码行数:50,代码来源:StackFrameManager.cs

示例8: Toggle

			public static void Toggle(DecompilerTextView textView, int line, int column) {
				var bps = SourceCodeMappingUtils.Find(textView, line, column);
				var ilbps = GetILCodeBreakpoints(textView, bps);
				if (ilbps.Count > 0) {
					if (IsEnabled(ilbps)) {
						foreach (var ilbp in ilbps)
							BreakpointManager.Instance.Remove(ilbp);
					}
					else {
						foreach (var bpm in ilbps)
							bpm.IsEnabled = true;
					}
				}
				else if (bps.Count > 0) {
					foreach (var bp in bps) {
						var md = bp.MemberMapping.MethodDefinition;
						var key = MethodKey.Create(md);
						if (key == null)
							continue;
						var asm = md.Module == null ? null : md.Module.Assembly;
						var asmName = asm == null ? null : asm.ManifestModule.Location;
						BreakpointManager.Instance.Add(new ILCodeBreakpoint(asmName, key.Value, bp.ILInstructionOffset.From));
					}
					textView.ScrollAndMoveCaretTo(bps[0].StartLocation.Line, bps[0].StartLocation.Column);
				}
			}
开发者ID:nakijun,项目名称:dnSpy,代码行数:26,代码来源:BreakpointManager.cs

示例9: Toggle

			public static void Toggle(DecompilerTextView textView, int line, int column) {
				var bps = SourceCodeMappingUtils.Find(textView, line, column);
				var ilbps = GetILCodeBreakpoints(textView, bps);
				if (ilbps.Count > 0) {
					if (IsEnabled(ilbps)) {
						foreach (var ilbp in ilbps)
							BreakpointManager.Instance.Remove(ilbp);
					}
					else {
						foreach (var bpm in ilbps)
							bpm.IsEnabled = true;
					}
				}
				else if (bps.Count > 0) {
					foreach (var bp in bps) {
						var md = bp.MemberMapping.MethodDef;
						var serMod = md.Module.ToSerializedDnSpyModule();
						var key = new SerializedDnSpyToken(serMod, md.MDToken);
						BreakpointManager.Instance.Add(new ILCodeBreakpoint(key, bp.ILInstructionOffset.From));
					}
					textView.ScrollAndMoveCaretTo(bps[0].StartLocation.Line, bps[0].StartLocation.Column);
				}
			}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:23,代码来源:BreakpointManager.cs


注:本文中的ICSharpCode.ILSpy.TextView.DecompilerTextView.ScrollAndMoveCaretTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。