public virtual async void  ReadNextBuffAsync()
        {
            var outData = new byte[fileStream.Length];

            if (this.fileStream.CanRead && !this.closeFile)
            {
                await this.fileStream.ReadAsync(outData, 0, this.bufferLength);

                fileLengthReaded += outData.Length;
                ReadProgress?.Invoke(fileLengthReaded, this.fileLength);
                ReadedDataAsync?.Invoke(outData);
            }
        }
示例#2
0
        public override async void ReadNextBuffAsync()
        {
            int low   = this.fileStream.ReadByte();
            int high  = this.fileStream.ReadByte();
            int count = low + (high << 8);

            if (count < 0)
            {
                fileLengthReaded = 0;
                ReadProgress?.Invoke(fileLength, fileLength);
                ReadedDataAsync?.Invoke(null);
            }
            else
            {
                var outData = new byte[count];
                await this.fileStream.ReadAsync(outData, 0, count);

                fileLengthReaded += outData.Length;
                ReadProgress?.Invoke(fileLengthReaded, fileLength);
                ReadedDataAsync?.Invoke(outData);
            }
        }