⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filechunk.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Core.P2P.FileTransportor
{
    using NCindy.Util;
    using NCindy.Util.Logging;
    using System;
    using System.Runtime.InteropServices;

    public class FileChunk
    {
        private readonly short blockID;
        private int currentBlockID;
        private readonly TransportingFile fileInfo;
        private const int Header_Size = 4;
        private static readonly ILogger log = LogFactory.CreateLogger(MethodBase.GetCurrentMethod().ReflectedType);
        public const int MAX_CHUNK_SIZE = 0x8000;

        public FileChunk(short blockID, TransportingFile fileInfo)
        {
            this.fileInfo = fileInfo;
            this.blockID = blockID;
        }

        public bool GetNextBlock(out DataBlock block)
        {
            block = null;
            if ((this.currentBlockID * 0x400) >= this.Length)
            {
                return false;
            }
            if ((this.currentBlockID * 0x400) >= this.Length)
            {
                return false;
            }
            block = new DataBlock(this, this.currentBlockID++);
            return true;
        }

        public short BlockID
        {
            get
            {
                return this.blockID;
            }
        }

        public string BlockMD5
        {
            get
            {
                return CryptoHelper.GetMD5(this.fileInfo.InnerFileStream, this.Offset, this.Length);
            }
        }

        public TransportingFile FileInfo
        {
            get
            {
                return this.fileInfo;
            }
        }

        public int Length
        {
            get
            {
                return Math.Min(0x8000, (int) (this.fileInfo.FileSize - this.Offset));
            }
        }

        public long Offset
        {
            get
            {
                return (long) (this.blockID * 0x8000);
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -