示例#1
0
 public CachedItem(Magnet magnet, int segmentLength, BitArray segments)
 {
     Magnet         = magnet;
     SegmentLength  = segmentLength;
     CachedSegments = segments;
     Created        = DateTime.Now;
 }
示例#2
0
        /// <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;
        }
示例#3
0
        /// <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);
        }
示例#4
0
 public DownloadItem(Magnet magnet) : this()
 {
     _magnet = magnet;
 }
示例#5
0
 public CachedItem(Magnet magnet, int segmentLength) :
     this(magnet, segmentLength, new BitArray(DownloadItem.SegmentsCount(magnet.Size, segmentLength)))
 {
 }