public CachedItem(Magnet magnet, int segmentLength, BitArray segments) { Magnet = magnet; SegmentLength = segmentLength; CachedSegments = segments; Created = DateTime.Now; }
/// <summary> /// Creates a new stream from currently downloading item /// </summary> /// <param name="downloadItem"></param> internal DcStream(DownloadItem downloadItem) { if (downloadItem == null) { throw new ArgumentNullException("downloadItem"); } Magnet = downloadItem.Magnet; _downloadItem = downloadItem; }
/// <summary> /// Creates a new stream from the file in a share /// </summary> /// <param name="filePath"></param> /// <param name="magnet"></param> internal DcStream(string filePath, Magnet magnet) { if (filePath == null) { throw new ArgumentNullException("filePath"); } Magnet = magnet; _fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); }
public DownloadItem(Magnet magnet) : this() { _magnet = magnet; }
public CachedItem(Magnet magnet, int segmentLength) : this(magnet, segmentLength, new BitArray(DownloadItem.SegmentsCount(magnet.Size, segmentLength))) { }