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