public override object ReadFrom(LiteBinaryReader reader, object obj)
 {
     Int32[] array = (Int32[])obj;
     for (int i = 0; i < array.Length; i++)
     {
         array[i] = reader.ReadInt32();
     }
     return(array);
 }
Esempio n. 2
0
        public override object ReadFrom(LiteBinaryReader reader, object obj)
        {
            int   length = reader.ReadInt32();
            IList list   = (IList)obj;

            for (int i = 0; i < length; i++)
            {
                list.Add(reader.ReadObject());
            }
            return(list);
        }
Esempio n. 3
0
        public override object Read(LiteBinaryReader reader)
        {
            int    cookie = reader.ReadInt32();
            object custom = reader.SerializationContext.GetObject(cookie);

            if (custom == null)
            {
                custom = _formatter.Deserialize(reader.BaseStream);
                reader.SerializationContext.CacheObjectForRead(custom);
            }
            return(custom);
        }
        public override object ReadFrom(LiteBinaryReader reader, object obj)
        {
            int         length = reader.ReadInt32();
            IDictionary dict   = (IDictionary)obj;

            for (int i = 0; i < length; i++)
            {
                object key   = reader.ReadObject();
                object value = reader.ReadObject();
                dict.Add(key, value);
            }
            return(dict);
        }
Esempio n. 5
0
        public sealed override object Read(LiteBinaryReader reader)
        {
            int    cookie = reader.ReadInt32();
            object obj    = reader.SerializationContext.GetObject(cookie);

            if (obj == null)
            {
                bool known = false;
                obj = New(reader);
                if (obj != null)
                {
                    reader.SerializationContext.CacheObjectForRead(obj);
                    known = true;
                }
                obj = ReadFrom(reader, obj);
                if (!known)
                {
                    reader.SerializationContext.CacheObjectForRead(obj);
                }
            }
            return(obj);
        }
        public override object New(LiteBinaryReader reader)
        {
            int length = reader.ReadInt32();

            return(new Int32[length]);
        }
Esempio n. 7
0
        public override object New(LiteBinaryReader reader)
        {
            int length = reader.ReadInt32();

            return(Array.CreateInstance(Type.GetElementType(), length));
        }
Esempio n. 8
0
 public override object Read(LiteBinaryReader reader)
 {
     return(reader.ReadInt32());
 }