コード例 #1
0
        // public methods ...
        /// <summary>
        /// Reads data using given reader.
        /// </summary>
        /// <param name="reader">The binary reader to use.</param>
        public void Read(BinaryReader reader)
        {
            reader.BaseStream.Seek(_Offset, SeekOrigin.Begin);

            while (reader.BaseStream.Position < _Offset + _Length)
            {
                byte byteType = reader.ReadByte();

                switch (byteType)
                {
                case 0:
                    reader.ReadByte();
                    break;

                case 1:
                    short  cbGrpprl   = reader.ReadInt16();
                    byte[] grpprlData = reader.ReadBytes(cbGrpprl);
                    break;

                case 2:
                    int tableLen = reader.ReadInt32();

                    _DescriptorOffsets = new FileOffsetCollection();
                    _DescriptorOffsets.Read(reader, GetOffsetsCount(tableLen, PieceDescriptor.Size));
                    _Descriptors = ReadDescriptors(reader, GetDescriptorsCount(tableLen, PieceDescriptor.Size));
                    break;
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Adds file offsets to the collection.
 /// </summary>
 /// <param name="offsets">The offsets to add.</param>
 public void AddRange(FileOffsetCollection offsets)
 {
     InnerList.AddRange(offsets);
 }