コード例 #1
0
        public Task SendFileAsync(string path, long offset, long?count, CancellationToken cancellation)
        {
            OnWrite();

            if (_compressionStream != null)
            {
                return(SendFileFallback.SendFileAsync(Stream, path, offset, count, cancellation));
            }

            return(_innerBodyFeature.SendFileAsync(path, offset, count, cancellation));
        }
        public Task SendFileAsync(string path, long offset, long?count, CancellationToken cancellationToken)
        {
            Initialize();

            if (_minificationEnabled || _compressionEnabled)
            {
                return(SendFileFallback.SendFileAsync(Stream, path, offset, count, cancellationToken));
            }

            return(_responseBodyFeature.SendFileAsync(path, offset, count, cancellationToken));
        }
コード例 #3
0
        public async Task SendFileAsync(string path, long offset, long?count, CancellationToken cancellationToken = default)
        {
            await inner.SendFileAsync(path, offset, count, cancellationToken);

            if (count != null)
            {
                bytesWritten += count.Value;
            }
            else
            {
                var file = new FileInfo(path);

                if (file.Exists)
                {
                    bytesWritten += file.Length;
                }
            }
        }
コード例 #4
0
 public Task SendFileAsync(string path, long offset, long?count, CancellationToken cancellationToken = default)
 {
     _captureStream.CaptureStream.Write(File.ReadAllBytes(path));
     return(_responseBodyFeature.SendFileAsync(path, offset, count, cancellationToken));
 }
コード例 #5
0
 public Task SendFileAsync(string path, long offset, long?count, CancellationToken cancellationToken = default)
 {
     return(_innerResponseBodyFeature.SendFileAsync(path, offset, count, cancellationToken));
 }