• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# TEXT_POSITION类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TEXT_POSITION的典型用法代码示例。如果您正苦于以下问题:C# TEXT_POSITION类的具体用法?C# TEXT_POSITION怎么用?C# TEXT_POSITION使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TEXT_POSITION类属于命名空间,在下文中一共展示了TEXT_POSITION类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1:

        // Binds this pending breakpoint to one or more code locations.
        int IDebugPendingBreakpoint2.Bind() {
            if (CanBind()) {
                // Get the location in the document that the breakpoint is in.
                var startPosition = new TEXT_POSITION[1];
                var endPosition = new TEXT_POSITION[1];
                string fileName;
                var docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(_bpRequestInfo.bpLocation.unionmember2));
                EngineUtils.CheckOk(docPosition.GetRange(startPosition, endPosition));
                EngineUtils.CheckOk(docPosition.GetFileName(out fileName));

                _breakpoint = _engine.Process.AddBreakpoint(
                    fileName,
                    (int)startPosition[0].dwLine,
                    (int)startPosition[0].dwColumn,
                    _enabled,
                    AD7BoundBreakpoint.GetBreakOnForPassCount(_bpRequestInfo.bpPassCount),
                    _bpRequestInfo.bpCondition.bstrCondition);

                _bpManager.AddPendingBreakpoint(_breakpoint, this);
                _breakpoint.BindAsync().WaitAsync(TimeSpan.FromSeconds(2)).Wait();

                return VSConstants.S_OK;
            }

            // The breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid expression, etc...
            // The sample engine does not support this, but a real world engine will want to send an instance of IDebugBreakpointErrorEvent2 to the
            // UI and return a valid instance of IDebugErrorBreakpoint2 from IDebugPendingBreakpoint2::EnumErrorBreakpoints. The debugger will then
            // display information about why the breakpoint did not bind to the user.
            return VSConstants.S_FALSE;
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:31,代码来源:AD7PendingBreakpoint.cs


示例2: AD7DocumentContext

 public AD7DocumentContext(string fileName, TEXT_POSITION begPos, TEXT_POSITION endPos, AD7MemoryAddress codeContext)
 {
     _fileName = fileName;
     _begPos = begPos;
     _endPos = endPos;
     _codeContext = codeContext;
 }
开发者ID:happylancer,项目名称:node-tools,代码行数:7,代码来源:AD7DocumentContext.cs


示例3: lock

        // Binds this pending breakpoint to one or more code locations.
        int IDebugPendingBreakpoint2.Bind()
        {
            try {
                if (CanBind()) {
                    var docPosition = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(m_bpRequestInfo.bpLocation.unionmember2);

                    // Get the name of the document that the breakpoint was put in
                    string documentName;
                    EngineUtils.CheckOk(docPosition.GetFileName(out documentName));

                    // Get the location in the document that the breakpoint is in.
                    var startPosition = new TEXT_POSITION[1];
                    var endPosition = new TEXT_POSITION[1];
                    EngineUtils.CheckOk(docPosition.GetRange(startPosition, endPosition));

                    var id = m_engine.DebuggedProcess.SetBreakpoint(documentName, startPosition[0].dwLine, startPosition[0].dwColumn);
                    if (id == -1)
                        return Constants.S_FALSE;
                    lock (this)
                        m_boundBreakpoints.Add(new AD7BoundBreakpoint(m_engine, id, this));

                    return Constants.S_OK;
                } else {
                    // The breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid expression, etc...
                    // The sample engine does not support this, but a real world engine will want to send an instance of IDebugBreakpointErrorEvent2 to the
                    // UI and return a valid instance of IDebugErrorBreakpoint2 from IDebugPendingBreakpoint2::EnumErrorBreakpoints. The debugger will then
                    // display information about why the breakpoint did not bind to the user.
                    return Constants.S_FALSE;
                }
            } catch (Exception e) {
                return EngineUtils.UnexpectedException(e);
            }
        }
开发者ID:bagobor,项目名称:NodeVsDebugger,代码行数:34,代码来源:AD7PendingBreakpoint.cs


示例4: AD7MemoryAddress

        public AD7MemoryAddress(AD7Engine engine, string filename, uint lineno, PythonStackFrame frame = null) {
            _engine = engine;
            _lineNo = (uint)lineno;
            _filename = filename;

            var pos = new TEXT_POSITION { dwLine = lineno, dwColumn = 0 };
            _documentContext = new AD7DocumentContext(filename, pos, pos, this, frame != null ? frame.Kind : FrameKind.None);
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:8,代码来源:AD7MemoryAddress.cs


示例5: AD7DocumentContext

 public AD7DocumentContext(string fileName, int lineNumber, TEXT_POSITION beginPosition, TEXT_POSITION endPosition, RoutineScope rs)
 {
   Debug.WriteLine("AD7DocumentContext: ctor");
   _fileName = fileName;
   _beginPosition = beginPosition;
   _endPosition = endPosition;
   _lineNumber = lineNumber;
   _rs = rs;
 }
开发者ID:jimmy00784,项目名称:mysql-connector-net,代码行数:9,代码来源:AD7DocumentContext.cs


示例6: AD7DocumentContext

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="fileName"> Short path file name. </param>
        /// <param name="begPos"> Start position. </param>
        /// <param name="endPos"> End position. In VSNDK debug engine, both begPos and endPos have the same value. </param>
        /// <param name="codeContext"> An address in a program's execution stream. </param>
        public AD7DocumentContext(string fileName, TEXT_POSITION begPos, TEXT_POSITION endPos, AD7MemoryAddress codeContext)
        {
            // Need to lengthen the path used by Visual Studio.
            StringBuilder documentNameSB = new StringBuilder(1024);
            GetLongPathName(fileName, documentNameSB, documentNameSB.Capacity);
            m_fileName = documentNameSB.ToString();

            m_begPos = begPos;
            m_endPos = endPos;
            m_codeContext = codeContext;
        }
开发者ID:blackberry,项目名称:VSPlugin,代码行数:18,代码来源:AD7DocumentContext.cs


示例7: GetSourceRange

        public int GetSourceRange(TEXT_POSITION[] pBegPosition, TEXT_POSITION[] pEndPosition)
        {
            Log.Debug("ScriptDocumentContext: GetSourceRange");

            pBegPosition[0].dwLine = (uint)_line;
            pBegPosition[0].dwColumn = (uint)_column;
            pEndPosition[0].dwLine = (uint)_line;
            pEndPosition[0].dwColumn = (uint)_column;

            return VSConstants.S_OK;
        }
开发者ID:vairam-svs,项目名称:poshtools,代码行数:11,代码来源:ScriptDocumentContext.cs


示例8: DebuggeeDocumentContext

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public DebuggeeDocumentContext (DebugEngine engine, string fileName, TEXT_POSITION beginPosition, TEXT_POSITION endPosition)
    {
      m_engine = engine;

      m_fileName = PathUtils.ConvertPathCygwinToWindows (fileName);

      m_beginPosition = beginPosition;

      m_endPosition = endPosition;

      m_codeContext = null;
    }
开发者ID:ashumeow,项目名称:android-plus-plus,代码行数:16,代码来源:DebuggeeDocumentContext.cs


示例9: GetLocation

        public void GetLocation(out string fileName, out int lineNumber, out TEXT_POSITION start, out TEXT_POSITION end) {
            var docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(_requestInfo.bpLocation.unionmember2));

            Marshal.ThrowExceptionForHR(docPosition.GetFileName(out fileName));

            var pStart = new TEXT_POSITION[1];
            var pEnd = new TEXT_POSITION[1];
            Marshal.ThrowExceptionForHR(docPosition.GetRange(pStart, pEnd));
            start = pStart[0];
            end = pEnd[0];

            lineNumber = (int)start.dwLine + 1;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:13,代码来源:AD7PendingBreakpoint.cs


示例10: GetStatementRange

 /// <summary>
 /// Gets the file statement range of the document context.
 /// A statement range is the range of the lines that contributed the code to which this document context refers.
 /// </summary>
 public int GetStatementRange(TEXT_POSITION[] pBegPosition, TEXT_POSITION[] pEndPosition)
 {
     DLog.Debug(DContext.VSDebuggerComCall, "DebugDocumentContext.GetStatementRange");
     var position = DocumentLocation.Position;
     if (position == null)
         return VSConstants.E_FAIL;
     // TEXT_POSITION starts counting at 0
     pBegPosition[0].dwLine = (uint) (position.Start.Line - 1);
     pBegPosition[0].dwColumn = (uint) (position.Start.Column - 1);
     pEndPosition[0].dwLine = (uint) (position.End.Line - 1);
     pEndPosition[0].dwColumn = (uint) (position.End.Column - 1);
     DLog.Debug(DContext.VSDebuggerComCall, "Range: {0}-{1}", position.Start, position.End);
     return VSConstants.S_OK;
 }
开发者ID:rfcclub,项目名称:dot42,代码行数:18,代码来源:DebugDocumentContext.cs


示例11: catch

        int IDebugStackFrame2.GetDocumentContext(out IDebugDocumentContext2 ppCxt) {
            var pos = new TEXT_POSITION { dwColumn = 0, dwLine = (uint)((StackFrame.LineNumber - 1) ?? 0) };

            string fileName = StackFrame.FileName;
            if (fileName != null) {
                try {
                    fileName = Path.GetFullPath(fileName);
                } catch (Exception) {
                }
            }

            ppCxt = new AD7DocumentContext(fileName, pos, pos, null);
            return VSConstants.S_OK;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:14,代码来源:AD7StackFrame.cs


示例12: GetRange

 public static TextSpan GetRange(this IDebugDocumentPosition2 documentPosition)
 {
     Contract.Requires<ArgumentNullException>(documentPosition != null, "documentPosition");
     TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
     TEXT_POSITION[] endPosition = new TEXT_POSITION[1];
     ErrorHandler.ThrowOnFailure(documentPosition.GetRange(startPosition, endPosition));
     return new TextSpan()
     {
         iStartLine = (int)startPosition[0].dwLine,
         iStartIndex = (int)startPosition[0].dwColumn,
         iEndLine = (int)endPosition[0].dwLine,
         iEndIndex = (int)endPosition[0].dwColumn
     };
 }
开发者ID:fjnogueira,项目名称:JavaForVS,代码行数:14,代码来源:DebugDocumentPositionExtensions.cs


示例13: GetDocumentContext

    // Get the document context for this pending breakpoint. A document context is a abstract representation of a source file 
    // location.
    public AD7DocumentContext GetDocumentContext(uint address) {
      IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(mBpRequestInfo.bpLocation.unionmember2));
      string documentName;
      EngineUtils.CheckOk(docPosition.GetFileName(out documentName));

      // Get the location in the document that the breakpoint is in.
      TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
      TEXT_POSITION[] endPosition = new TEXT_POSITION[1];
      EngineUtils.CheckOk(docPosition.GetRange(startPosition, endPosition));

      AD7MemoryAddress codeContext = new AD7MemoryAddress(mEngine, address);

      return new AD7DocumentContext(documentName, startPosition[0], startPosition[0], codeContext);
    }
开发者ID:iSalva,项目名称:Cosmos,代码行数:16,代码来源:AD7PendingBreakpoint.cs


示例14: GetTextLine

 public static string GetTextLine(IDebugDocumentContext2 context, TEXT_POSITION start, TEXT_POSITION end)
 {
     //IVsTextManager2 tm2 = (IVsTextManager2)serviceProvider.GetService(typeof(SVsTextManager));
     //IVsTextView activeView;
     //int hResult = tm2.GetActiveView2(1, null, (uint)_VIEWFRAMETYPE.vftCodeWindow, out activeView);
     string name;
     context.GetName(enum_GETNAME_TYPE.GN_MONIKERNAME, out name);
     IVsTextView txtView;
     Debugger.ShowSource(context, 0, 0, 0, 0, out txtView);
     if (txtView != null)
     {
         string line;
         txtView.GetTextStream((int)start.dwLine, (int)start.dwColumn, (int)end.dwLine, (int)end.dwColumn, out line);
         return line;
     }
     return null;
 }
开发者ID:chrisparnin,项目名称:ganji,代码行数:17,代码来源:HandleException.cs


示例15: GetDocumentText

 public static string GetDocumentText(IDebugDocumentText2 pText, TEXT_POSITION pos)
 {
     string documentText = string.Empty;
     if (pText != null)
     {
         uint numLines = 0;
         uint numChars = 0;
         int hr;
         hr = pText.GetSize(ref numLines, ref numChars);
         if (ErrorHandler.Succeeded(hr))
         {
             IntPtr buffer = Marshal.AllocCoTaskMem((int)numChars * sizeof(char));
             uint actualChars = 0;
             hr = pText.GetText(pos, numChars, buffer, out actualChars);
             if (ErrorHandler.Succeeded(hr))
             {
                 documentText = Marshal.PtrToStringUni(buffer, (int)actualChars);
             }
             Marshal.FreeCoTaskMem(buffer);
         }
     }
     return documentText;
 }
开发者ID:chrisparnin,项目名称:ganji,代码行数:23,代码来源:HandleException.cs


示例16: Bind

        public int Bind()
        {
            IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(m_bpRequestInfo.bpLocation.unionmember2));

            string filename;
            docPosition.GetFileName(out filename);

            TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
            TEXT_POSITION[] endPosition = new TEXT_POSITION[1];
            EngineUtils.CheckOk(docPosition.GetRange(startPosition, endPosition));

            Command bpCommand = new BreakpointCommand(Path.GetFileName(filename), (int)startPosition[0].dwLine + 1);
            m_engine.EnqueueCommand(bpCommand);

            AD7DocumentContext docContext = new AD7DocumentContext(filename, startPosition[0], endPosition[0]);

            AD7BreakpointResolution breakpointResolution = new AD7BreakpointResolution(this.m_engine, docContext);
            AD7BoundBreakpoint boundBreakpoint = new AD7BoundBreakpoint(this.m_engine, this, breakpointResolution);

            string fileandline = Path.GetFileName(filename) + ((int)startPosition[0].dwLine + 1).ToString();
            m_bpManager.StoreBoundBreakpoint(fileandline, boundBreakpoint);

            return VSConstants.S_OK;
        }
开发者ID:Strongc,项目名称:VSLua,代码行数:24,代码来源:AD7PendingBreakpoint.cs


示例17: BindAsync

        internal async Task BindAsync()
        {
            if (CanBind())
            {
                string documentName = null;
                string functionName = null;
                TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
                TEXT_POSITION[] endPosition = new TEXT_POSITION[1];
                string condition = null;
                string address = null;
                ulong codeAddress = 0;
                uint size = 0;
                IEnumerable<Checksum> checksums = null;

                lock (_boundBreakpoints)
                {
                    if (_bp != null)   // already bound
                    {
                        Debug.Fail("Breakpoint already bound");
                        return;
                    }
                    if ((_bpRequestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0
                        && _bpRequestInfo.bpCondition.styleCondition == enum_BP_COND_STYLE.BP_COND_WHEN_TRUE)
                    {
                        condition = _bpRequestInfo.bpCondition.bstrCondition;
                    }
                    if ((_bpRequestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_BPLOCATION) != 0)
                    {
                        switch ((enum_BP_LOCATION_TYPE)_bpRequestInfo.bpLocation.bpLocationType)
                        {
                            case enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET:
                                {
                                    IDebugFunctionPosition2 functionPosition = HostMarshal.GetDebugFunctionPositionForIntPtr(_bpRequestInfo.bpLocation.unionmember2);
                                    EngineUtils.CheckOk(functionPosition.GetFunctionName(out functionName));
                                    break;
                                }
                            case enum_BP_LOCATION_TYPE.BPLT_CODE_CONTEXT:
                                {
                                    IDebugCodeContext2 codePosition = HostMarshal.GetDebugCodeContextForIntPtr(_bpRequestInfo.bpLocation.unionmember1);
                                    if (!(codePosition is AD7MemoryAddress))
                                    {
                                        goto default;   // context is not from this engine
                                    }
                                    codeAddress = ((AD7MemoryAddress)codePosition).Address;
                                    break;
                                }
                            case enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE:
                                {
                                    IDebugDocumentPosition2 docPosition = HostMarshal.GetDocumentPositionForIntPtr(_bpRequestInfo.bpLocation.unionmember2);

                                    // Get the name of the document that the breakpoint was put in
                                    EngineUtils.CheckOk(docPosition.GetFileName(out documentName));

                                    // Get the location in the document that the breakpoint is in.
                                    EngineUtils.CheckOk(docPosition.GetRange(startPosition, endPosition));

                                    // Get the document checksum
                                    // TODO: This and all other AD7 interface calls need to be moved so that they are only
                                    // executed from the main thread.
                                    // Github issue: https://github.com/Microsoft/MIEngine/issues/350
                                    if (_engine.DebuggedProcess.MICommandFactory.SupportsBreakpointChecksums())
                                    {
                                        try
                                        {
                                            checksums = GetSHA1Checksums();
                                        }
                                        catch (Exception)
                                        {
                                            // If we fail to get a checksum there's nothing else we can do
                                        }
                                    }

                                    break;
                                }
                            case enum_BP_LOCATION_TYPE.BPLT_DATA_STRING:
                                {
                                    address = HostMarshal.GetDataBreakpointStringForIntPtr(_bpRequestInfo.bpLocation.unionmember3);
                                    size = (uint)_bpRequestInfo.bpLocation.unionmember4;
                                    if (condition != null)
                                    {
                                        goto default;   // mi has no conditions on watchpoints
                                    }
                                    break;
                                }
                            default:
                                {
                                    this.SetError(new AD7ErrorBreakpoint(this, ResourceStrings.UnsupportedBreakpoint), true);
                                    return;
                                }
                        }
                    }
                }
                PendingBreakpoint.BindResult bindResult;
                // Bind all breakpoints that match this source and line number.
                if (documentName != null)
                {
                    bindResult = await PendingBreakpoint.Bind(documentName, startPosition[0].dwLine + 1, startPosition[0].dwColumn, _engine.DebuggedProcess, condition, _enabled, checksums, this);
                }
                else if (functionName != null)
                {
//.........这里部分代码省略.........
开发者ID:rajkumar42,项目名称:MIEngine,代码行数:101,代码来源:AD7PendingBreakpoint.cs


示例18: MITextPosition

 public MITextPosition(string filename, TEXT_POSITION beginPosition, TEXT_POSITION endPosition)
 {
     this.FileName = filename;
     this.BeginPosition = beginPosition;
     this.EndPosition = endPosition;
 }
开发者ID:aluitink,项目名称:aspnet-debug2,代码行数:6,代码来源:MITextPosition.cs


示例19:

 int IDebugDocumentContext2.GetStatementRange(TEXT_POSITION[] pBegPosition, TEXT_POSITION[] pEndPosition) {
     pBegPosition[0] = Start;
     pEndPosition[0] = End;
     return VSConstants.S_OK;
 }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:5,代码来源:AD7DocumentContext.cs


示例20: GetDocumentContext

        // Get the document context for this pending breakpoint. A document context is a abstract representation of a source file 
        // location.
        public AD7DocumentContext GetDocumentContext(ulong address, string functionName)
        {
            if ((enum_BP_LOCATION_TYPE)_bpRequestInfo.bpLocation.bpLocationType == enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                IDebugDocumentPosition2 docPosition = HostMarshal.GetDocumentPositionForIntPtr(_bpRequestInfo.bpLocation.unionmember2);
                string documentName;
                EngineUtils.CheckOk(docPosition.GetFileName(out documentName));

                // Get the location in the document that the breakpoint is in.
                TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
                TEXT_POSITION[] endPosition = new TEXT_POSITION[1];
                EngineUtils.CheckOk(docPosition.GetRange(startPosition, endPosition));

                AD7MemoryAddress codeContext = new AD7MemoryAddress(_engine, address, functionName);

                return new AD7DocumentContext(new MITextPosition(documentName, startPosition[0], startPosition[0]), codeContext, _engine.DebuggedProcess);
            }
            else
            {
                return null;
            }
        }
开发者ID:rajkumar42,项目名称:MIEngine,代码行数:24,代码来源:AD7PendingBreakpoint.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TFPos类代码示例发布时间:2022-05-24
下一篇:
C# TDBTransaction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap