示例#1
0
        /// <summary>
        /// Creates a new DownloadFile
        /// </summary>
        public DownloadFile()
        {
            DownloadHeader = new DownloadHeader();

            _EncodingMap = new[]
            {
                new EMap(EType.None, 6),
                new EMap(EType.None, 6),
                new EMap(EType.ZLib, 9),
            };
        }
示例#2
0
        public void Read(BinaryReader br, DownloadHeader header)
        {
            EKey           = new MD5Hash(br.ReadBytes(header.EKeySize));
            CompressedSize = br.ReadUInt40BE();
            Priority       = (sbyte)(br.ReadSByte() - header.BasePriority);

            if (header.IncludeChecksum)
            {
                Checksum = br.ReadUInt32BE();
            }

            if (header.Version >= 2)
            {
                Flags = br.ReadBytes(header.FlagSize);
            }
        }
示例#3
0
        public void Write(BinaryWriter bw, DownloadHeader header)
        {
            bw.Write(EKey.Value);
            bw.WriteUInt40BE(CompressedSize);

            bw.Write((sbyte)(Priority + header.BasePriority));

            if (header.IncludeChecksum)
            {
                bw.WriteUInt32BE(Checksum);
            }

            if (header.Version >= 2)
            {
                bw.Write(Flags);
            }
        }