Exemplo n.º 1
0
        private static IEnumerable <CsvItem> ParseCsv(string csvName)
        {
            using (var reader = File.OpenText(csvName))
                using (var csv = new CsvReader(reader))
                {
                    csv.Configuration.Delimiter         = ",";
                    csv.Configuration.MissingFieldFound = null;

                    // skip the header
                    csv.Read();

                    while (csv.Read())
                    {
                        var releaseDate = csv.GetField <string>(0);
                        var hash        = csv.GetField <string>(1);
                        var topic       = csv.GetField <int>(2);
                        var post        = csv.GetField <int>(3);
                        var author      = csv.GetField <string>(4);
                        var title       = csv.GetField <string>(5);
                        var description = csv.GetField <string>(6);
                        var size        = csv.GetField <long>(7);
                        var category    = csv.GetField <int>(8);

                        var item = new CsvItem(releaseDate, hash, topic, post, author, title, description, size, category);

                        yield return(item);
                    }
                }
        }
Exemplo n.º 2
0
 private static string BuildMagnetUri(CsvItem item)
 {
     return(new StringBuilder("magnet:?xt=urn:btih:")
            .Append(item.Hash)
            .Append("&dn=")
            .Append(HttpUtility.UrlEncode($"{item.Title}-{item.Author}"))
            .Append("&tr=http://tracker.tntvillage.scambioetico.org:2710/announce")
            .Append("&tr=udp://tracker.tntvillage.scambioetico.org:2710/announce")
            .Append("&tr=udp://tracker.coppersurfer.tk:6969/announce")
            .Append("&tr=udp://tracker.leechers-paradise.org:6969/announce")
            .Append("&tr=udp://IPv6.leechers-paradise.org:6969/announce")
            .Append("&tr=udp://tracker.internetwarriors.net:1337/announce")
            .Append("&tr=udp://tracker.tiny-vps.com:6969/announce")
            .Append("&tr=udp://tracker.mg64.net:2710/announce")
            .Append("&tr=udp://tracker.openbittorrent.com:80/announce")
            .ToString());
 }