Esempio n. 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);
        }
Esempio n. 2
0
        public async Task <Dictionary <string, PropDesc> > InspectObject(KiRef handle, int start, int end)
        {
            var reply = await DoRequest(KiTag.REQ, KiRequest.InspectObject, handle, start, end);

            var props = new Dictionary <string, PropDesc>();
            int i     = 1;

            while (i < reply.Length)
            {
                string    key   = reply[i++].ToString();
                PropFlags flags = (PropFlags)(int)reply[i++];
                if (flags.HasFlag(PropFlags.Accessor))
                {
                    KiAtom   getter    = reply[i++];
                    KiAtom   setter    = reply[i++];
                    PropDesc propValue = new PropDesc(getter, setter, flags);
                    if (!flags.HasFlag(PropFlags.Internal))
                    {
                        props.Add(key, propValue);
                    }
                }
                else
                {
                    KiAtom   value     = reply[i++];
                    PropDesc propValue = new PropDesc(value, flags);
                    if (!flags.HasFlag(PropFlags.Internal))
                    {
                        props.Add(key, propValue);
                    }
                }
            }
            return(props);
        }