Example #1
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);
        }
Example #2
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));
        }