Example #1
0
        public override void Execute(object[] arguments)
        {
            if (arguments.Length != 1)
            {
                throw new ArgumentOutOfRangeException("arguments");
            }

            var variable = arguments[0] as NodeEvaluationResult;

            if (variable == null)
            {
                string message = string.Format("Invalid arguments: {0}", arguments);
                throw new ArgumentException(message, "arguments");
            }

            // Retrieve references
            var refs       = (JArray)_message["refs"];
            var references = new Dictionary <int, JToken>(refs.Count);

            for (int i = 0; i < refs.Count; i++)
            {
                JToken reference = refs[i];
                var    id        = (int)reference["handle"];
                references.Add(id, reference);
            }

            // Retrieve properties
            var variableId = variable.Id.ToString(CultureInfo.InvariantCulture);
            var objectData = _message["body"][variableId];
            var properties = new List <NodeEvaluationResult>();

            var props = (JArray)objectData["properties"];

            if (props != null)
            {
                for (int i = 0; i < props.Count; i++)
                {
                    var variableProvider        = new LookupVariableProvider(props[i], references, variable);
                    NodeEvaluationResult result = NodeMessageFactory.CreateVariable(variableProvider);
                    properties.Add(result);
                }
            }

            // Try to get prototype
            var prototype = objectData["protoObject"];

            if (prototype != null)
            {
                var variableProvider        = new LookupPrototypeProvider(prototype, references, variable);
                NodeEvaluationResult result = NodeMessageFactory.CreateVariable(variableProvider);
                properties.Add(result);
            }

            Children = properties.OrderBy(p => p.Name).ToList();
        }
Example #2
0
        private static List <NodeEvaluationResult> GetVariables(JArray variables, IDebuggerManager debugger, NodeStackFrame stackFrame)
        {
            var results = new List <NodeEvaluationResult>(variables.Count);

            for (int j = 0; j < variables.Count; j++)
            {
                JToken variable             = variables[j];
                var    variableProvider     = new BacktraceVariableProvider(variable, debugger, stackFrame);
                NodeEvaluationResult result = NodeMessageFactory.CreateVariable(variableProvider);
                results.Add(result);
            }
            return(results);
        }
        public override void Execute(object[] arguments)
        {
            if (arguments.Length != 3)
            {
                throw new ArgumentOutOfRangeException("arguments");
            }

            var debugger   = arguments[0] as IDebuggerManager;
            var stackFrame = arguments[1] as NodeStackFrame;
            var name       = arguments[2] as string;

            if (debugger == null || stackFrame == null)
            {
                string message = string.Format("Invalid arguments: {0}", arguments);
                throw new ArgumentException(message, "arguments");
            }

            var variableProvider = new NewValueVariableProvider(_message, debugger, stackFrame, name);

            Result = NodeMessageFactory.CreateVariable(variableProvider);
        }