Example #1
0
 object convertFromMsgPackObject(MsgPack.MessagePackObject mpobj)
 {
     if (mpobj.IsDictionary)
     {
         return(convertFromMsgPackObjectDictionary(mpobj.AsDictionary()));
     }
     if (mpobj.IsList)
     {
         return(convertFromMsgPackObjectList(mpobj.AsList()));
     }
     return(mpobj.ToObject());
 }
Example #2
0
        static object convertFromMsgPackObject(MsgPack.MessagePackObject mpobj)
        {
            if (mpobj.IsDictionary)
            {
                return(convertFromMsgPackObjectDictionary(mpobj.AsDictionary()));
            }
            if (mpobj.IsList)
            {
                return(convertFromMsgPackObjectList(mpobj.AsList()));
            }

            object obj = mpobj.ToObject();

            if (typeof(int).IsInstanceOfType(obj))
            {
                return((Int64)(int)obj);
            }
            else if (typeof(byte).IsInstanceOfType(obj))
            {
                return((Int64)(byte)obj);
            }
            else if (typeof(short).IsInstanceOfType(obj))
            {
                return((Int64)(short)obj);
            }
            else if (typeof(ushort).IsInstanceOfType(obj))
            {
                return((Int64)(ushort)obj);
            }
            else if (typeof(char).IsInstanceOfType(obj))
            {
                return((Int64)(char)obj);
            }
            else if (typeof(uint).IsInstanceOfType(obj))
            {
                return((Int64)(uint)obj);
            }
            else if (typeof(ulong).IsInstanceOfType(obj))
            {
                return((Int64)(ulong)obj);
            }
            return(obj);
        }
        public IList <MessagePackObject> AsList()
        {
            var internalList = _msgPackObject.AsList();

            return(internalList.Select(x => new MessagePackObject(x)).ToList());
        }