Esempio n. 1
0
        public void Serialize(Stream stream)
        {
            byte[] buffer = new byte[SIZE];

            using (MemoryStream ms = new MemoryStream(buffer))
            {
                BinaryWriter writer = new BinaryWriter(ms);
                writer.Write(TITLE);

                writer.Write(Version);
                writer.Write(UseCompression);

                //last flush location
                SystemData.Serialize(writer);

                //tag
                if (Tag == null)
                {
                    writer.Write((int)-1);
                }
                else
                {
                    writer.Write(Tag.Length);
                    writer.Write(Tag);
                }
            }

            stream.Seek(0, SeekOrigin.Begin);
            stream.Write(buffer, 0, buffer.Length);
        }
Esempio n. 2
0
        //public Pointer Clone()
        //{
        //    Pointer pointer = new Pointer(Version, Ptr);
        //    pointer.IsReserved = this.IsReserved;
        //    pointer.RefCount = this.RefCount;

        //    return pointer;
        //}

        public void Serialize(BinaryWriter writer)
        {
            writer.Write(Version);
            Ptr.Serialize(writer);
        }