internal MultipartContent PrepareMultipartContent(CancellationToken token) { var content = new CompressedMultiPartContent("form-data", syncingBoundary); foreach (var item in needList) { token.ThrowIfCancellationRequested(); var @from = Convert.ToInt64(item.FileOffset); var length = Convert.ToInt64(item.BlockLength); var to = from + length - 1; switch (item.BlockType) { case RdcNeedType.Source: content.Add(new SourceFilePart(new NarrowedStream(sourceStream, from, to))); break; case RdcNeedType.Seed: content.Add(new SeedFilePart(@from, to)); break; default: throw new NotSupportedException(); } } return(content); }
internal MultipartContent PrepareMultipartContent(CancellationToken token) { var content = new CompressedMultiPartContent("form-data", syncingBoundary); foreach (var item in needList) { token.ThrowIfCancellationRequested(); var @from = Convert.ToInt64(item.FileOffset); var length = Convert.ToInt64(item.BlockLength); var to = from + length - 1; switch (item.BlockType) { case RdcNeedType.Source: content.Add(new SourceFilePart(new NarrowedStream(sourceStream, from, to))); break; case RdcNeedType.Seed: content.Add(new SeedFilePart(@from, to)); break; default: throw new NotSupportedException(); } } return content; }