public Variable[] GetEvaluatedVariables(string expression, int threadId, int frameIndex, int[] path)
        {
            var machine     = Controller.GetTokenForThread(threadId).Machine;
            var srcVariable = Evaluate(threadId, frameIndex, expression);

            IValue value;

            try
            {
                value = GetMachine(threadId).Evaluate(expression, true);
            }
            catch (Exception e)
            {
                value = ValueFactory.Create(e.Message);
            }

            var locals = GetChildVariables(MachineVariable.Create(value, "$eval"));

            foreach (var step in path)
            {
                var variable = locals[step];
                locals = GetChildVariables(variable);
            }

            return(GetDebugVariables(locals));
        }
        public virtual Variable Evaluate(int threadId, int contextFrame, string expression)
        {
            try
            {
                var value = GetMachine(threadId)
                            .Evaluate(expression, true)
                            .GetRawValue();

                var variable = _visualizer.GetVariable(MachineVariable.Create(value, "$evalResult"));
                return(variable);
            }
            catch (ScriptException e)
            {
                return(CreateDebuggerVariable("$evalFault", e.ErrorDescription,
                                              "Ошибка"));
            }
        }
        private void FillKeyValueProperties(IEnumerable <KeyAndValueImpl> collection, List <IVariable> variables)
        {
            var propsCount = collection.Count();

            int i = 0;

            foreach (var kv in collection)
            {
                IVariable value;

                value = MachineVariable.Create(kv, i.ToString());

                variables.Add(value);

                i++;
            }
        }
        public virtual Variable Evaluate(int threadId, int contextFrame, string expression)
        {
            try
            {
                var value = GetMachine(threadId).Evaluate(expression, true);

                var variable = CreateDebuggerVariable("$evalResult",
                                                      value.AsString(), value.SystemType.Name);

                variable.IsStructured = IsStructured(MachineVariable.Create(value, "$eval"));

                return(variable);
            }
            catch (ScriptException e)
            {
                return(CreateDebuggerVariable("$evalFault", e.ErrorDescription,
                                              "Ошибка"));
            }
        }
        public virtual Variable[] GetEvaluatedVariables(string expression, int threadId, int frameIndex, int[] path)
        {
            IValue value;

            try
            {
                value = GetMachine(threadId).Evaluate(expression, true);
            }
            catch (Exception e)
            {
                value = ValueFactory.Create(e.Message);
            }

            var locals = GetChildVariables(MachineVariable.Create(value, "$eval"));

            foreach (var step in path)
            {
                var variable = locals[step];
                locals = GetChildVariables(variable);
            }

            return(GetDebugVariables(locals));
        }
        private void FillProperties(IVariable src, List <IVariable> variables)
        {
            var obj        = src.AsObject();
            var propsCount = obj.GetPropCount();

            for (int i = 0; i < propsCount; i++)
            {
                string propName = obj.GetPropName(i);

                IVariable value;

                try
                {
                    value = MachineVariable.Create(obj.GetPropValue(i), propName);
                }
                catch (Exception e)
                {
                    value = MachineVariable.Create(ValueFactory.Create(e.Message), propName);
                }

                variables.Add(value);
            }
        }
 public Variable Evaluate(int threadId, int contextFrame, string expression)
 {
     try
     {
         var value = GetMachine(threadId).Evaluate(expression, true);
         return(new Variable()
         {
             Name = "$evalResult",
             Presentation = value.AsString(),
             TypeName = value.SystemType.Name,
             IsStructured = IsStructured(MachineVariable.Create(value, "$eval"))
         });
     }
     catch (ScriptException e)
     {
         return(new Variable()
         {
             Name = "$evalFault",
             Presentation = e.ErrorDescription,
             TypeName = "Ошибка",
             IsStructured = false
         });
     }
 }
        private void FillIndexedProperties(IVariable src, List <IVariable> variables)
        {
            var obj = src.AsObject();

            if (obj is ICollectionContext cntx)
            {
                var itemsCount = cntx.Count();
                for (int i = 0; i < itemsCount; i++)
                {
                    IValue value;

                    try
                    {
                        value = obj.GetIndexedValue(ValueFactory.Create(i));
                    }
                    catch (Exception)
                    {
                        continue;
                    }

                    variables.Add(MachineVariable.Create(value, i.ToString()));
                }
            }
        }