Esempio n. 1
0
        public void Download(CancellationToken cancellationToken)
        {
            Assert.MethodCalledOnlyOnce(ref _downloadHasBeenCalled, "Download");

            DebugLogger.Log("Downloading.");

            _lastProgress = 0.0;

            try
            {
                _torrentClient = new TorrentClient(new UnityTorrentClientProcessStartInfoProvider());
                DownloadTorrentFile(cancellationToken);
                AddTorrent();
                WaitForTorrentDownload(cancellationToken);
                MoveDownloadedFile();
            }
            finally
            {
                if (_torrentClient != null)
                {
                    _torrentClient.Dispose();
                }
                Cleanup();
            }
        }
Esempio n. 2
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            DebugLogger.LogDispose();

            if (disposing && _torrentClient != null)
            {
                _torrentClient.Dispose();
            }

            _disposed = true;
        }