示例#1
0
        public async Task <Dictionary <string, PropDesc> > GetObjPropDescRange(HeapPtr ptr, int start, int end)
        {
            var reply = await DoRequest(DValueTag.REQ, Request.GetObjPropDescRange, ptr, start, end);

            var props = new Dictionary <string, PropDesc>();
            int count = (reply.Length - 1) / 2;
            int i     = 1;

            while (i < reply.Length)
            {
                PropFlags flags = (PropFlags)(int)reply[i++];
                string    name  = reply[i++].ToString();
                if (flags.HasFlag(PropFlags.Accessor))
                {
                    DValue   getter    = reply[i++];
                    DValue   setter    = reply[i++];
                    PropDesc propValue = new PropDesc(getter, setter, flags);
                    if (!flags.HasFlag(PropFlags.Internal))
                    {
                        props.Add(name, propValue);
                    }
                }
                else
                {
                    DValue   value     = reply[i++];
                    PropDesc propValue = new PropDesc(value, flags);
                    if (!flags.HasFlag(PropFlags.Internal) && value.Tag != DValueTag.Unused)
                    {
                        props.Add(name, propValue);
                    }
                }
            }
            return(props);
        }
示例#2
0
 public PropDesc(DValue getter, DValue setter, PropFlags flags)
 {
     Value  = null;
     Getter = getter;
     Setter = setter;
     Flags  = flags;
 }
示例#3
0
        /// <summary>
        /// Gets a list of local values and their values. Note that objects
        /// are not evaluated and are listed simply as "{ obj: 'ClassName' }".
        /// </summary>
        /// <param name="stackOffset">The call stack offset to get locals for, -1 being the current activation.</param>
        /// <returns></returns>
        public async Task <IReadOnlyDictionary <string, DValue> > GetLocals(int stackOffset = -1)
        {
            var reply = await DoRequest(DValueTag.REQ, Request.GetLocals, stackOffset);

            var vars  = new Dictionary <string, DValue>();
            int count = (reply.Length - 1) / 2;

            for (int i = 0; i < count; ++i)
            {
                string name  = (string)reply[1 + i * 2];
                DValue value = reply[2 + i * 2];
                vars.Add(name, value);
            }
            return(vars);
        }
示例#4
0
        public static DMessage Receive(Socket socket)
        {
            List <DValue> fields = new List <DValue>();
            DValue        value;

            do
            {
                if ((value = DValue.Receive(socket)) == null)
                {
                    return(null);
                }
                if (value.Tag != DValueTag.EOM)
                {
                    fields.Add(value);
                }
            } while (value.Tag != DValueTag.EOM);
            return(new DMessage(fields.ToArray()));
        }
示例#5
0
        public DMessage(params dynamic[] values)
        {
            List <DValue> fields = new List <DValue>();
            DValue        fieldValue;

            foreach (dynamic value in values)
            {
                if (value is DValue)
                {
                    fieldValue = value;
                }
                else if (value is Request || value is AppRequest)
                {
                    fieldValue = new DValue((int)value);
                }
                else
                {
                    fieldValue = new DValue(value);
                }
                fields.Add(fieldValue);
            }
            _fields = fields.ToArray();
        }
示例#6
0
 public PropDesc(DValue value, PropFlags flags)
 {
     Value  = value;
     Getter = Setter = null;
     Flags  = flags;
 }