Beispiel #1
0
        static public void RawSearchTest(string engine, string search, string sort)
        {
            TorrentSearchEngine tse           = new TorrentSearchEngine("MyTorrents.xml");
            ITorrentSearch      torrentSearch = tse.Create(engine);

            string      raw    = torrentSearch.RawSearch(search, sort, null);
            CultureInfo mylang = CultureInfo.CurrentCulture;

            Console.OutputEncoding = Encoding.GetEncoding(mylang.TextInfo.ANSICodePage);
            Console.WriteLine(raw);
        }
Beispiel #2
0
        static public void LoginTest(string engine)
        {
            Console.WriteLine("LoginTest: {0}", engine);
            TorrentSearchEngine tse           = new TorrentSearchEngine("MyTorrents.xml");
            ITorrentSearch      torrentSearch = tse.Create(engine);
            HttpWebResponse     r             = torrentSearch.Login();

            Console.WriteLine("Response: {0} - {1}", r.StatusCode, r.StatusDescription);
            for (int i = 0; i < r.Headers.Count; ++i)
            {
                Console.WriteLine("Header Name:{0}, Value :{1}", r.Headers.Keys[i], r.Headers[i]);
            }
        }
Beispiel #3
0
        static public void SearchTest(string engine, string search, string sort)
        {
            Console.WriteLine("SearchTest: {0}:\"{1}\":{2}", engine, search, sort);
            TorrentSearchEngine tse           = new TorrentSearchEngine("MyTorrents.xml");
            ITorrentSearch      torrentSearch = tse.Create(engine);

            TorrentMatchList matchList = torrentSearch.Search(search, sort, null);
            CultureInfo      mylang    = CultureInfo.CurrentCulture;

            Console.OutputEncoding = Encoding.GetEncoding(mylang.TextInfo.ANSICodePage);
            foreach (TorrentMatch match in matchList)
            {
                Console.WriteLine("Found: {0} (Size:{1:F2} MB))", match.Title, match.Size / (1024 * 1024));
            }
        }
        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;
        }