Exemplo n.º 1
0
        /* Constructor */

        /// <summary>
        /// Initializes a new instance of the <see cref="TorrentsData" /> class.
        /// </summary>
        public TorrentsData()
        {
            this.baseDir = Environment.CurrentDirectory;
            this.GetValues(out this.torrentsDir, out this.downloadDir, out this.uploadSpeed, out this.downloadSpeed);
            this.fastResumeFile  = Path.Combine(this.torrentsDir, "fastresume.data");
            this.dhtNodeFile     = Path.Combine(this.baseDir, "DhtNodes");
            this.torrentManagers = new List <TorrentManager>();
            this.topTrackers     = new TopListeners(10);

            Console.CancelKeyPress += delegate { this.Shutdown(); };
            AppDomain.CurrentDomain.ProcessExit        += delegate { this.Shutdown(); };
            AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine(e.ExceptionObject); this.Shutdown(); };
            Thread.GetDomain().UnhandledException      += delegate(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine(e.ExceptionObject); this.Shutdown(); };

            this.InitializeEngine();
            this.torrentDefaults = new TorrentSettings(4, 150, this.downloadSpeed, this.uploadSpeed);
        }
Exemplo n.º 2
0
        /* Constructor */
        /// <summary>
        /// Initializes a new instance of the <see cref="TorrentsData" /> class.
        /// </summary>
        public TorrentsData()
        {
            this.baseDir = Environment.CurrentDirectory;
            this.GetValues(out this.torrentsDir, out this.downloadDir, out this.uploadSpeed, out this.downloadSpeed);
            this.fastResumeFile = Path.Combine(this.torrentsDir, "fastresume.data");
            this.dhtNodeFile = Path.Combine(this.baseDir, "DhtNodes");
            this.torrentManagers = new List<TorrentManager>();
            this.topTrackers = new TopListeners(10);

            Console.CancelKeyPress += delegate { this.Shutdown(); };
            AppDomain.CurrentDomain.ProcessExit += delegate { this.Shutdown(); };
            AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine(e.ExceptionObject); this.Shutdown(); };
            Thread.GetDomain().UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine(e.ExceptionObject); this.Shutdown(); };

            this.InitializeEngine();
            this.torrentDefaults = new TorrentSettings(4, 150, this.downloadSpeed, this.uploadSpeed);
        }