Exemple #1
0
        public object Deserialize(BinaryReader reader)
        {
            int            id             = (int)reader.ReadByte();
            ObjectStreamer objectStreamer = this.streamerByTypeId[id];

            return(objectStreamer.Read(reader));
        }
Exemple #2
0
        public void Serialize(BinaryWriter writer, object obj)
        {
            Type           type           = obj.GetType();
            ObjectStreamer objectStreamer = this.streamerByType[type];

            writer.Write(objectStreamer.typeId);
            objectStreamer.Write(writer, obj);
        }
Exemple #3
0
        internal byte[] WriteObjectData()
        {
            MemoryStream   memoryStream   = new MemoryStream();
            BinaryWriter   writer         = new BinaryWriter(memoryStream);
            ObjectStreamer objectStreamer = this.file.streamerManager.streamerByType[this.obj.GetType()];

            objectStreamer.Write(writer, this.obj);
            byte[] array = memoryStream.ToArray();
            if (this.compressionLevel == 0)
            {
                return(array);
            }
            QuickLZ quickLZ = new QuickLZ();

            return(quickLZ.Compress(array));
        }
Exemple #4
0
        public virtual object GetObject()
        {
            if (this.obj != null)
            {
                return(this.obj);
            }
            if (this.objLength == -1)
            {
                return(null);
            }
            MemoryStream   input          = new MemoryStream(this.ReadObjectData());
            BinaryReader   reader         = new BinaryReader(input);
            ObjectStreamer objectStreamer = this.file.streamerManager.streamerByTypeId[(int)this.typeId];

            this.obj = objectStreamer.Read(reader);
            if (this.typeId == 101)
            {
                ((DataSeries)this.obj).Init(this.file, this);
            }
            return(this.obj);
        }
 public void Add(ObjectStreamer streamer)
 {
     throw new NotImplementedException();
 }
Exemple #6
0
 public void Add(ObjectStreamer streamer)
 {
     streamer.streamerManager = this;
     this.streamerByTypeId[(int)streamer.typeId] = streamer;
     this.streamerByType[streamer.type]          = streamer;
 }
Exemple #7
0
 public void Add(ObjectStreamer streamer)
 {
     streamer.streamerManager = this;
     this.streamerByTypeId[(int)streamer.typeId] = streamer;
     this.streamerByType[streamer.type] = streamer;
 }