Exemplo n.º 1
0
        // Parses a text-based expression for evaluation.
        // The engine sample only supports locals and parameters so the only task here is to check the names in those collections.
        int IDebugExpressionContext2.ParseText(string pszCode, enum_PARSEFLAGS dwFlags, uint nRadix, out IDebugExpression2 ppExpr,
                                               out string pbstrError,
                                               out uint pichError)
        {
            //System.Windows.Forms.MessageBox.Show("pszCode: " + pszCode);
            pbstrError = "";
            pichError  = 0;
            ppExpr     = null;

            try {
                if (mParams != null)
                {
                    foreach (DebugLocalInfo currVariable in mParams)
                    {
                        if (String.CompareOrdinal(currVariable.Name, pszCode) == 0)
                        {
                            ppExpr = new AD7Expression(currVariable, mProcess, this);
                            return(VSConstants.S_OK);
                        }
                    }
                }

                if (mLocals != null)
                {
                    foreach (DebugLocalInfo currVariable in mLocals)
                    {
                        if (String.CompareOrdinal(currVariable.Name, pszCode) == 0)
                        {
                            ppExpr = new AD7Expression(currVariable, mProcess, this);
                            return(VSConstants.S_OK);
                        }
                    }
                }

                pbstrError = "Invalid Expression";
                pichError  = (uint)pbstrError.Length;
                return(VSConstants.S_FALSE);
            } catch (Exception e) {
                return(EngineUtils.UnexpectedException(e));
            }
        }
Exemplo n.º 2
0
    // Parses a text-based expression for evaluation.
    // The engine sample only supports locals and parameters so the only task here is to check the names in those collections.
    int IDebugExpressionContext2.ParseText(string pszCode, enum_PARSEFLAGS dwFlags, uint nRadix, out IDebugExpression2 ppExpr,
                                            out string pbstrError,
                                            out uint pichError) {
      //System.Windows.Forms.MessageBox.Show("pszCode: " + pszCode);
      pbstrError = "";
      pichError = 0;
      ppExpr = null;

      try {
        if (mParams != null) {
          foreach (DebugLocalInfo currVariable in mParams) {
            if (String.CompareOrdinal(currVariable.Name, pszCode) == 0) {
              ppExpr = new AD7Expression(currVariable, mProcess, this);
              return VSConstants.S_OK;
            }
          }
        }

        if (mLocals != null) {
          foreach (DebugLocalInfo currVariable in mLocals) {
            if (String.CompareOrdinal(currVariable.Name, pszCode) == 0) {
              ppExpr = new AD7Expression(currVariable, mProcess, this);
              return VSConstants.S_OK;
            }
          }
        }

        pbstrError = "Invalid Expression";
        pichError = (uint)pbstrError.Length;
        return VSConstants.S_FALSE;
      } catch (Exception e) {
        return EngineUtils.UnexpectedException(e);
      }
    }