Ejemplo n.º 1
0
        private void Serialize(BinaryWriter writer)
        {
            maxPositionPlusSize = AtomicHeader.SIZE;

            writer.Write(maxHandle);
            writer.Write(currentVersion);

            //write free
            space.Serialize(writer);

            //write used
            writer.Write(used.Count);
            foreach (var kv in used)
            {
                writer.Write(kv.Key);
                kv.Value.Serialize(writer);

                long posPlusSize = kv.Value.Ptr.PositionPlusSize;
                if (posPlusSize > maxPositionPlusSize)
                {
                    maxPositionPlusSize = posPlusSize;
                }
            }

            //write reserved
            writer.Write(reserved.Count);
            foreach (var kv in reserved)
            {
                writer.Write(kv.Key);
                kv.Value.Serialize(writer);

                long posPlusSize = kv.Value.Ptr.PositionPlusSize;
                if (posPlusSize > maxPositionPlusSize)
                {
                    maxPositionPlusSize = posPlusSize;
                }
            }
        }
Ejemplo n.º 2
0
        private void Serialize(BinaryWriter writer)
        {
            writer.Write(maxHandle);
            writer.Write(currentVersion);

            //write free
            space.Serialize(writer);

            //write used
            writer.Write(used.Count);
            foreach (var kv in used)
            {
                writer.Write(kv.Key);
                kv.Value.Serialize(writer);
            }

            //write reserved
            writer.Write(reserved.Count);
            foreach (var kv in reserved)
            {
                writer.Write(kv.Key);
                kv.Value.Serialize(writer);
            }
        }