C#MagnetLink转到torrent文件

时间:2017-04-28 21:18:34

标签: c# networking torrent magnet-uri

我现在发疯了。由于所有其他问题已有几年的历史,MonoTorrent开发人员已经离开了MIA,我真的需要你的帮助。

我真正坚持的是解析磁力链接并下载它。

这是我的代码:

    public static void DownloadTorrent(string magnetLink)
    {
        MagnetLink link = new MagnetLink(magnetLink);

        //URL stores the magnetlink
        EngineSettings settings = new EngineSettings();
        settings.AllowedEncryption = EncryptionTypes.All;
        settings.SavePath = destination;

        string torrentFilePath = torrentDestination;

        if (!Directory.Exists(settings.SavePath))
            Directory.CreateDirectory(settings.SavePath);

        if (!Directory.Exists(torrentFilePath))
            Directory.CreateDirectory(torrentFilePath);

        //Create a new engine, give it some settings and use it.
        ClientEngine engine = new ClientEngine(settings);
        engine.ChangeListenEndpoint(new IPEndPoint(IPAddress.Any, 6969));

        TorrentManager manager = new TorrentManager(link, engine.Settings.SavePath, new TorrentSettings(), torrentFilePath);
        engine.Register(manager);
        manager.Start();

        Console.ReadLine();

    }

我的磁铁链接是:"magnet:?xt=urn:btih:c6df2f47d033d54b054cafe7ef683ba167222d92&dn=Windows+XP+Professional+SP3+-+Activated&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969"

现在磁铁链接上出现错误,说“#34;没有这样的主机已知并且指的是udp://exodus.desync.com:6969 /"(Visual Studio是瑞典语,所以可能不会是一个字面翻译)。

Visual Studio将tracker = new UdpClient(announceUrl.Host, announceUrl.Port);标记为错误源,它位于MonoTorrent的一个代码文件中; UdpTracker.cs

我正在尝试制作一个简单的应用程序,我只是坚持这一部分。

非常感谢任何帮助。这是我第一次在这里发帖,所以如果我错过了提及任何东西只是告诉我,我会添加它。

感谢正手!同时请原谅我的英语,我不是母语人士。

更新:即使没有MonoTorrnet,如果你知道解决这个问题的另一种方法 - 我会尽力帮助。

0 个答案:

没有答案