コード例 #1
0
 /// <summary>
 /// 文件读取完当前块当前事件
 /// </summary>
 /// <param name="e"></param>
 public void FileABlockReadEndEvent(FileBlockSteamReaderEventArgs e)
 {
     if (ABlockReadEndEvent != null)
     {
         this.ABlockReadEndEvent(this, e);
     }
 }
コード例 #2
0
        /// <summary>
        /// 开始读取文件
        /// </summary>
        /// <returns>以Bitmap类型返回每次读取文件的内容</returns>
        public byte[] SpliteRead()
        {
            FileBlockSteamReaderEventArgs Fbsr = new FileBlockSteamReaderEventArgs();

            byte[] timeReadContect;
            this.Seek(splitSize * (readTimes - 1), SeekOrigin.Begin);
            if (readTimes < (this.FileSize / this.splitSize + 1))
            {
                Fbsr.ReadPercent = (int)(((float)this.Position / this.FileSize) * 100);
                timeReadContect  = new byte[this.splitSize];
            }
            else
            {
                timeReadContect  = new byte[this.FinilReadSize];
                judge            = true;
                Fbsr.ReadPercent = 100;
            }
            CurrentReadSize = timeReadContect.Length;
            this.Read(timeReadContect, 0, timeReadContect.Length);
            FileABlockReadEndEvent(Fbsr);
            readTimes++;
            return(timeReadContect);
        }