public TorrentRandomAccessStream(TorrentStreamManager manager)
 {
     _manager = manager;
     _torrentFile = manager.TorrentVideoFile;
     _torrent = manager.Torrent;
     var stream = File.Open(Path.Combine(_torrentFile.TargetFolder.Path, _torrentFile.Path), FileMode.Open,
         FileAccess.Read, FileShare.ReadWrite);
     _internalStream = stream.AsRandomAccessStream();
 }
        public TorrentRandomAccessStream(TorrentStreamManager manager)
        {
            _manager     = manager;
            _torrentFile = manager.TorrentVideoFile;
            _torrent     = manager.Torrent;
            var stream = File.Open(Path.Combine(_torrentFile.TargetFolder.Path, _torrentFile.Path), FileMode.Open,
                                   FileAccess.Read, FileShare.ReadWrite);

            _internalStream = stream.AsRandomAccessStream();
        }
Exemplo n.º 3
0
 public void Stop()
 {
     var managerCopy = StreamManager;
     StreamManager.TorrentManager.TorrentStateChanged += (sender, args) =>
     {
         if (args.NewState == TorrentState.Stopped)
         {
             _engine.Unregister(managerCopy.TorrentManager);
             File.Delete(Path.Combine(managerCopy.TorrentVideoFile.TargetFolder.Path, managerCopy.TorrentVideoFile.Path));
         }
     };
     StreamManager.Dispose();
     StreamManager = null;
 }
Exemplo n.º 4
0
 public void CreateManager(MagnetLink link)
 {
     var manager = link.CreateManager(_engine.Settings.SaveFolder);
     _engine.Register(manager);
     StreamManager = new TorrentStreamManager(manager);
 }
Exemplo n.º 5
0
 public void CreateManager(InfoHash hash)
 {
     var manager = hash.CreateManager(_engine.Settings.SaveFolder);
     _engine.Register(manager);
     StreamManager = new TorrentStreamManager(manager);
 }
Exemplo n.º 6
0
 public void CreateManager(Torrent torrent)
 {
     var manager = torrent.CreateManager(_engine.Settings.SaveFolder);
     _engine.Register(manager);
     StreamManager = new TorrentStreamManager(manager);
 }