示例#1
0
        /// <summary>
        /// </summary>
        /// <param name="streams">
        /// </param>
        /// <param name="directoryRoot">
        /// </param>
        /// <param name="directorySize">
        /// </param>
        /// <param name="bits">
        /// </param>
        private void WriteDirectory(DataStream[] streams, out int directoryRoot, out int directorySize, BitAccess bits)
        {
            var directory = new DataStream();

            var pages = 0;

            for (var s = 0; s < streams.Length; s++)
            {
                if (streams[s].Length > 0)
                {
                    pages += streams[s].Pages;
                }
            }

            var use = 4 * (1 + streams.Length + pages);

            bits.MinCapacity(use);
            bits.WriteInt32(streams.Length);
            for (var s = 0; s < streams.Length; s++)
            {
                bits.WriteInt32(streams[s].Length);
            }

            for (var s = 0; s < streams.Length; s++)
            {
                if (streams[s].Length > 0)
                {
                    bits.WriteInt32(streams[s].pages);
                }
            }

            directory.Write(this, bits.Buffer, use);
            directorySize = directory.Length;

            use = 4 * directory.Pages;
            bits.MinCapacity(use);
            bits.WriteInt32(directory.pages);

            var ddir = new DataStream();

            ddir.Write(this, bits.Buffer, use);

            directoryRoot = ddir.pages[0];
        }
示例#2
0
        /// <summary>
        /// </summary>
        /// <param name="writer">
        /// </param>
        /// <param name="bits">
        /// </param>
        internal void Write(Stream writer, BitAccess bits)
        {
            bits.MinCapacity(56);
            bits.WriteBytes(this.magic);         // 0..31
            bits.WriteInt32(this.pageSize);      // 32..35
            bits.WriteInt32(this.freePageMap);   // 36..39
            bits.WriteInt32(this.pagesUsed);     // 40..43
            bits.WriteInt32(this.directorySize); // 44..47
            bits.WriteInt32(this.zero);          // 48..51
            bits.WriteInt32(this.directoryRoot); // 52..55

            writer.Seek(0, SeekOrigin.Begin);
            bits.WriteBuffer(writer, 56);
        }
示例#3
0
        /// <summary>
        /// </summary>
        /// <param name="streams">
        /// </param>
        /// <param name="directoryRoot">
        /// </param>
        /// <param name="directorySize">
        /// </param>
        /// <param name="bits">
        /// </param>
        private void WriteDirectory(DataStream[] streams, out int directoryRoot, out int directorySize, BitAccess bits)
        {
            var directory = new DataStream();

            var pages = 0;
            for (var s = 0; s < streams.Length; s++)
            {
                if (streams[s].Length > 0)
                {
                    pages += streams[s].Pages;
                }
            }

            var use = 4 * (1 + streams.Length + pages);
            bits.MinCapacity(use);
            bits.WriteInt32(streams.Length);
            for (var s = 0; s < streams.Length; s++)
            {
                bits.WriteInt32(streams[s].Length);
            }

            for (var s = 0; s < streams.Length; s++)
            {
                if (streams[s].Length > 0)
                {
                    bits.WriteInt32(streams[s].pages);
                }
            }

            directory.Write(this, bits.Buffer, use);
            directorySize = directory.Length;

            use = 4 * directory.Pages;
            bits.MinCapacity(use);
            bits.WriteInt32(directory.pages);

            var ddir = new DataStream();
            ddir.Write(this, bits.Buffer, use);

            directoryRoot = ddir.pages[0];
        }
示例#4
0
        /// <summary>
        /// </summary>
        /// <param name="writer">
        /// </param>
        /// <param name="bits">
        /// </param>
        internal void Write(Stream writer, BitAccess bits)
        {
            bits.MinCapacity(56);
            bits.WriteBytes(this.magic); // 0..31
            bits.WriteInt32(this.pageSize); // 32..35
            bits.WriteInt32(this.freePageMap); // 36..39
            bits.WriteInt32(this.pagesUsed); // 40..43
            bits.WriteInt32(this.directorySize); // 44..47
            bits.WriteInt32(this.zero); // 48..51
            bits.WriteInt32(this.directoryRoot); // 52..55

            writer.Seek(0, SeekOrigin.Begin);
            bits.WriteBuffer(writer, 56);
        }