Example #1
0
        /// <summary>
        /// Adds byte stream to the packed data.
        /// </summary>
        /// <param name="data">The byte data to add.</param>
        public void AddStream(byte[] data)
        {
            if (data == null)
            {
                return;
            }
            PackedDataStream stream = new PackedDataStream(data);

            streams.Add(stream);
        }
Example #2
0
        void WriteStreams(BinaryWriter writer)
        {
            int count = data.StreamCount;

            for (int i = 0; i < count; i++)
            {
                PackedDataStream stream = (PackedDataStream)data[i];
                writer.Write(stream.Data);
            }
        }
Example #3
0
        // private methods...
        PackedDataHeader WriteHeader(BinaryWriter writer)
        {
            Stream baseStream  = writer.BaseStream;
            int    headerStart = (int)baseStream.Length;

            baseStream.Seek(headerStart, SeekOrigin.Begin);
            PackedDataHeader header = new PackedDataHeader();

            header.Start = headerStart;
            int count = data.StreamCount;

            for (int i = 0; i < count; i++)
            {
                PackedDataStream stream = data[i];
                int length = stream.Data.Length;
                header.DataTable.AddRow(length);
            }
            header.Write(writer);
            WriteOptions(writer);
            return(header);
        }