public List <DAPVariable> GetRow(DAPVariablesRequest msg, int rowIndex)
        {
            if (rowIndex < 0 || rowIndex >= Tuples.Count)
            {
                throw new RequestFailedException($"Requested nonexistent row {rowIndex}");
            }

            int startIndex = msg.start == null ? 0 : (int)msg.start;
            int numVars    = (msg.count == null || msg.count == 0) ? NumColumns : (int)msg.count;
            int lastIndex  = Math.Min(startIndex + numVars, NumColumns);
            // TODO req.filter, format

            var row       = Tuples[rowIndex];
            var variables = new List <DAPVariable>();

            for (var i = startIndex; i < startIndex + numVars; i++)
            {
                var dapVar = new DAPVariable
                {
                    name                         = ColumnNames == null?i.ToString() : ColumnNames[i],
                                           value = Formatter.ValueToString(row.Column[i])
                };
                variables.Add(dapVar);
            }

            return(variables);
        }
示例#2
0
        private List <DAPVariable> GetQueryResultVariables(DAPVariablesRequest msg, int frameIndex)
        {
            if (frameIndex != 0)
            {
                throw new RequestFailedException($"Requested query results for bad frame {frameIndex}");
            }

            int startIndex = msg.start == null ? 0 : (int)msg.start;
            int numVars    = (msg.count == null || msg.count == 0) ? LastQueryResults.Count : (int)msg.count;
            int lastIndex  = Math.Min(startIndex + numVars, LastQueryResults.Count);
            // TODO req.filter, format

            var variables = new List <DAPVariable>();

            for (var i = startIndex; i < startIndex + numVars; i++)
            {
                var variable = LastQueryResults[i];
                var dapVar   = new DAPVariable
                {
                    name  = variable.Name,
                    value = variable.Value,
                    type  = variable.Type
                };
                variables.Add(dapVar);
            }

            return(variables);
        }
        public List <DAPVariable> GetRows(DAPVariablesRequest msg)
        {
            int startIndex = msg.start == null ? 0 : (int)msg.start;
            int numVars    = (msg.count == null || msg.count == 0) ? Tuples.Count : (int)msg.count;
            int lastIndex  = Math.Min(startIndex + numVars, Tuples.Count);
            // TODO req.filter, format

            var variables = new List <DAPVariable>();

            for (var i = startIndex; i < startIndex + numVars; i++)
            {
                var row    = Tuples[i];
                var dapVar = new DAPVariable
                {
                    name  = i.ToString(),
                    value = "(" + Formatter.TupleToString(row) + ")",
#pragma warning disable CS0675 // Bitwise-or operator used on a sign-extended operand
                    variablesReference = VariableIndexPrefix | i,
#pragma warning restore CS0675 // Bitwise-or operator used on a sign-extended operand
                    indexedVariables = ColumnNames == null ? NumColumns : 0,
                    namedVariables   = ColumnNames == null ? 0 : NumColumns
                };
                variables.Add(dapVar);
            }

            return(variables);
        }
示例#4
0
        private List <DAPVariable> GetStackVariables(DAPVariablesRequest msg, int frameIndex)
        {
            if (frameIndex < 0 || frameIndex >= Stack.Count)
            {
                throw new RequestFailedException($"Requested variables for unknown frame {frameIndex}");
            }

            var frame      = Stack[frameIndex];
            int startIndex = msg.start == null ? 0 : (int)msg.start;
            int numVars    = (msg.count == null || msg.count == 0) ? frame.Variables.Count : (int)msg.count;
            int lastIndex  = Math.Min(startIndex + numVars, frame.Variables.Count);
            // TODO req.filter, format

            var variables = new List <DAPVariable>();

            for (var i = startIndex; i < startIndex + numVars; i++)
            {
                var variable = frame.Variables[i];
                var dapVar   = new DAPVariable
                {
                    name  = variable.Name,
                    value = variable.Value,
                    type  = variable.Type
                };
                variables.Add(dapVar);
            }

            return(variables);
        }