Exemplo n.º 1
0
        private static object \uE01D(Stream \uE053, \uE015 \uE054, sbyte \uE055, Type \uE056)
        {
            Type type  = typeof(object);
            Type type2 = typeof(object);

            if (\uE056.IsGenericType)
            {
                Type[] genericArguments = \uE056.GetGenericArguments();
                if (genericArguments.Length >= 1)
                {
                    type = genericArguments[0];
                }
                if (genericArguments.Length >= 2)
                {
                    type2 = genericArguments[1];
                }
            }
            int         num        = CpInazumaMsgPack.\uE005(\uE053, \uE054, \uE055);
            IDictionary dictionary = Activator.CreateInstance(typeof(Dictionary <, >).MakeGenericType(new Type[]
            {
                type,
                type2
            })) as IDictionary;

            for (int i = 0; i < num; i++)
            {
                object key   = CpInazumaMsgPack.Unpack(\uE053, type);
                object value = CpInazumaMsgPack.Unpack(\uE053, type2);
                dictionary.Add(key, value);
            }
            return(dictionary);
        }
Exemplo n.º 2
0
        public static T Unpack <T>(string file_path)
        {
            if (!File.Exists(file_path))
            {
                return(default(T));
            }
            FileStream fileStream = new FileStream(file_path, FileMode.Open);
            T          result     = CpInazumaMsgPack.Unpack <T>(fileStream);

            fileStream.Close();
            return(result);
        }
Exemplo n.º 3
0
        public static object Unpack(byte[] buffer, Type type)
        {
            if (buffer == null)
            {
                return(null);
            }
            MemoryStream memoryStream = new MemoryStream(buffer);
            object       result       = CpInazumaMsgPack.Unpack(memoryStream, type);

            memoryStream.Close();
            return(result);
        }
Exemplo n.º 4
0
        private static object \uE020(Stream \uE05D, ref \uE017 \uE05E)
        {
            sbyte  b   = 0;
            \uE015 uE  = CpInazumaMsgPack.\uE00A(\uE05D, out b);
            object obj = Activator.CreateInstance(\uE05E.\uE000);

            if (CpInazumaMsgPack.\uE010(uE))
            {
                int num = CpInazumaMsgPack.\uE005(\uE05D, uE, b);
                for (int i = 0; i < num; i++)
                {
                    CpInazumaMsgPack.\uE001 uE2 = new CpInazumaMsgPack.\uE001();
                    uE         = CpInazumaMsgPack.\uE00A(\uE05D, out b);
                    uE2.\uE000 = CpInazumaMsgPack.\uE01E(\uE05D, uE, b);
                    \uE016 uE3 = \uE05E.\uE001.Find(new Predicate <\uE016>(uE2.\uE000));
                    if (uE3 == null)
                    {
                        CpInazumaMsgPack.Unpack(\uE05D, typeof(object));
                    }
                    else
                    {
                        TypeCode typeCode = Type.GetTypeCode(uE3.\uE002.FieldType);
                        object   value    = CpInazumaMsgPack.\uE014(CpInazumaMsgPack.Unpack(\uE05D, uE3.\uE002.FieldType), typeCode);
                        uE3.\uE002.SetValue(obj, value);
                    }
                }
                return(obj);
            }
            if (CpInazumaMsgPack.\uE00F(uE))
            {
                \uE05D.Seek((long)CpInazumaMsgPack.\uE004(uE, b), SeekOrigin.Current);
                return(CpInazumaMsgPack.\uE020(\uE05D, ref \uE05E));
            }
            \uE05D.Seek(-1L, SeekOrigin.Current);
            if (uE == global::\uE015.\uE00A)
            {
                return(null);
            }
            for (int j = 0; j < \uE05E.\uE001.Count; j++)
            {
                FieldInfo uE4  = \uE05E.\uE001[j].\uE002;
                object    obj2 = CpInazumaMsgPack.Unpack(\uE05D, uE4.FieldType);
                if (obj2 != null)
                {
                    uE4.SetValue(obj, Convert.ChangeType(obj2, uE4.FieldType));
                }
            }
            return(obj);
        }
Exemplo n.º 5
0
        private static object \uE01C(Stream \uE04F, \uE015 \uE050, sbyte \uE051, Type \uE052)
        {
            int   num  = CpInazumaMsgPack.\uE005(\uE04F, \uE050, \uE051);
            Type  type = null;
            IList list = CpInazumaMsgPack.\uE013(\uE052, num, out type);

            for (int i = 0; i < num; i++)
            {
                object value = CpInazumaMsgPack.Unpack(\uE04F, type);
                try
                {
                    list[i] = Convert.ChangeType(value, type);
                }
                catch (InvalidCastException)
                {
                    list[i] = value;
                }
            }
            return(list);
        }
Exemplo n.º 6
0
        public static T Unpack <T>(Stream stream)
        {
            Type typeFromHandle = typeof(T);

            return((T)((object)Convert.ChangeType(CpInazumaMsgPack.Unpack(stream, typeFromHandle), typeFromHandle)));
        }
Exemplo n.º 7
0
 public static T Unpack <T>(byte[] buffer)
 {
     return((T)((object)Convert.ChangeType(CpInazumaMsgPack.Unpack(buffer, typeof(T)), typeof(T))));
 }