Ejemplo n.º 1
0
        public void SearchTorrent(string searchEngine, string searchString, string sortOrder, object id)
        {
            Log.Instance().Print(string.Format("search torrents {0} {1} {2}", searchEngine, searchString, sortOrder));
            TorrentSearchParameters p = new TorrentSearchParameters(searchEngine, searchString, sortOrder, null);

            _bgWorker                            = new BackgroundWorker();
            _bgWorker.DoWork                    += new DoWorkEventHandler(_bgWorker_DoWork);
            _bgWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
            _bgWorker.ProgressChanged           += new ProgressChangedEventHandler(_bgWorker_ProgressChanged);
            _bgWorker.WorkerSupportsCancellation = true;
            _bgWorker.RunWorkerAsync(p);
        }
Ejemplo n.º 2
0
        void _bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            TorrentSearchParameters p   = e.Argument as TorrentSearchParameters;
            TorrentSearchEngine     tse = null;

            try

            {
                tse = new TorrentSearchEngine(Configuration.Instance().Settings["TorrentSearch.Config"] as string);
            }
            catch
            {
                Log.Instance().Print("Mytorrents.xml cofig file loading failed!");
            }
            ITorrentSearch   t         = tse.Create(p.SearchEngine);
            TorrentMatchList matchList = t.Search(p.SearchString, p.SortOrder, null);

            e.Result = matchList;
        }