Пример #1
0
	private void exitMenuItem_Click(object sender, System.EventArgs e)
	{
		if (this.btsession != null)
			this.btsession.Dispose();
		this.btsession = null;

		WinForms.Application.Exit();
	}
Пример #2
0
	private void Thread()
	{
		// initialise bittorrent session
		this.btsession = new BT.Session();

		while ( mThreadRunning )
		{
			btsession.ProcessWaitingData();
			System.Threading.Thread.Sleep( 10 );
		}
	}
Пример #3
0
	/// <summary>
	/// Clean up any resources being used.
	/// </summary>
	protected override void Dispose( bool disposing )
	{
		mThreadRunning = false;

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

		if (this.btsession != null)
			this.btsession.Dispose();
		this.btsession = null;

		base.Dispose( disposing );
	}
Пример #4
0
		/// <summary>Contructs a torrent using the metainfo filename</summary>
		/// <param name="metafilename">Filename of the metainfo file</param>
		internal Torrent( Session session, string metafilename )
		{
			this.mSession = session;
			this.infofile = new MetainfoFile(metafilename);
			this.downloadFile = new DownloadFile(infofile);
			this.peerManager = new PeerManager();
			this.mDownloadStrategy = new DownloadStrategyManager( this );
			this.uploadManager = new UploadManager(infofile, downloadFile);
			this.tp = new TrackerProtocol(this, infofile, downloadFile);

	//		this.downloadManager.PieceFinished += new PieceFinishedCallback(downloadManager_PieceFinished);
			this.uploadManager.PieceSectionFinished += new PieceSectionFinishedCallback(uploadManager_PieceSectionFinished);

			this.tp.TrackerUpdate += new TrackerUpdateCallback(tp_TrackerUpdate);
		}