Exemplo n.º 1
0
        public BitTorrentManager(BitTorrentCache bittorrentCache, string selfNameSpace,
            DictionaryServiceProxy dhtProxy, DictionaryServiceTracker dhtTracker, ClientEngine clientEngine,
            TorrentSettings torrentDefaults, TorrentHelper torrentHelper,
            bool startSeedingAtStartup)
        {
            _bittorrentCache = bittorrentCache;
              SelfNameSpace = selfNameSpace;
              _dictProxy = dhtProxy;
              _dictTracker = dhtTracker;
              _torrentDefaults = torrentDefaults;
              _startSeedingAtStartup = startSeedingAtStartup;

              RegisterClientEngineEventHandlers(clientEngine);
              _clientEngine = clientEngine;

              _torrentHelper = torrentHelper;

              try {
            _fastResumeData = BEncodedValue.Decode<BEncodedDictionary>(
              File.ReadAllBytes(_bittorrentCache.FastResumeFilePath));
              } catch {
            _fastResumeData = new BEncodedDictionary();
              }

              // CacheRegistry is created here because the default cache registry file path is
              // defined here.
              CacheRegistry = new CacheRegistry(_bittorrentCache.CacheRegistryFilePath, selfNameSpace);
              CacheRegistry.LoadCacheDir(_bittorrentCache.DownloadsDirPath);
        }
Exemplo n.º 2
0
        public BitTorrentManager(BitTorrentCache bittorrentCache, string selfNameSpace,
                                 DictionaryServiceProxy dhtProxy, DictionaryServiceTracker dhtTracker, ClientEngine clientEngine,
                                 TorrentSettings torrentDefaults, TorrentHelper torrentHelper,
                                 bool startSeedingAtStartup)
        {
            _bittorrentCache       = bittorrentCache;
            SelfNameSpace          = selfNameSpace;
            _dictProxy             = dhtProxy;
            _dictTracker           = dhtTracker;
            _torrentDefaults       = torrentDefaults;
            _startSeedingAtStartup = startSeedingAtStartup;

            RegisterClientEngineEventHandlers(clientEngine);
            _clientEngine = clientEngine;

            _torrentHelper = torrentHelper;

            try {
                _fastResumeData = BEncodedValue.Decode <BEncodedDictionary>(
                    File.ReadAllBytes(_bittorrentCache.FastResumeFilePath));
            } catch {
                _fastResumeData = new BEncodedDictionary();
            }

            // CacheRegistry is created here because the default cache registry file path is
            // defined here.
            CacheRegistry = new CacheRegistry(_bittorrentCache.CacheRegistryFilePath, selfNameSpace);
            CacheRegistry.LoadCacheDir(_bittorrentCache.DownloadsDirPath);
        }