コード例 #1
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            string Torrent_path = Generate_torrent.generate_torrent_F();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;


            TorrentInfo.TryLoad(Torrent_path, out torrent);


            torrentClient = new TorrentClient.TorrentClient("Enter port you want to use", @"Enter where your torrent file is saved");
            torrentClient.DownloadSpeedLimit = 1000000 * 1024; // 100 KB/s
            torrentClient.UploadSpeedLimit   = 2000000 * 1024; // 200 KB/s
            torrentClient.TorrentHashing    += TorrentClient_TorrentHashing;
            torrentClient.TorrentLeeching   += TorrentClient_TorrentLeeching;
            torrentClient.TorrentSeeding    += TorrentClient_TorrentSeeding;
            torrentClient.TorrentStarted    += TorrentClient_TorrentStarted;
            torrentClient.TorrentStopped    += TorrentClient_TorrentStopped;
            torrentClient.Start();        // start torrent client
            torrentClient.Start(torrent); // start torrent file

            // setup checkout timer
            var timer = new System.Timers.Timer();

            timer.Interval = 1;
            timer.Elapsed += Timer_Elapsed;
            timer.Enabled  = true;
            timer.Start();

            Thread.Sleep(10000000);
        }
コード例 #2
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            TorrentInfo.TryLoad(@".\..\..\Test\TorrentClientTest.Data\TorrentFile.torrent", out torrent);

            torrentClient = new TorrentClient.TorrentClient(4000, @".\Test"); // listening port, base torrent data directory
            torrentClient.DownloadSpeedLimit = 100 * 1024;                    // 100 KB/s
            torrentClient.UploadSpeedLimit   = 200 * 1024;                    // 200 KB/s
            torrentClient.TorrentHashing    += TorrentClient_TorrentHashing;
            torrentClient.TorrentLeeching   += TorrentClient_TorrentLeeching;
            torrentClient.TorrentSeeding    += TorrentClient_TorrentSeeding;
            torrentClient.TorrentStarted    += TorrentClient_TorrentStarted;
            torrentClient.TorrentStopped    += TorrentClient_TorrentStopped;
            torrentClient.Start();        // start torrent client
            torrentClient.Start(torrent); // start torrent file

            // setup checkout timer
            var timer = new System.Timers.Timer();

            timer.Interval = 10000;
            timer.Elapsed += Timer_Elapsed;
            timer.Enabled  = true;
            timer.Start();

            Thread.Sleep(10000000);
        }