LibtorrentDotNet 1.1.0

dotnet add package LibtorrentDotNet --version 1.1.0                
NuGet\Install-Package LibtorrentDotNet -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LibtorrentDotNet" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LibtorrentDotNet --version 1.1.0                
#r "nuget: LibtorrentDotNet, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LibtorrentDotNet as a Cake Addin
#addin nuget:?package=LibtorrentDotNet&version=1.1.0

// Install LibtorrentDotNet as a Cake Tool
#tool nuget:?package=LibtorrentDotNet&version=1.1.0                

localImage

LibtorrentDotNet

Overview

LibtorrentDotNet is a C++/CLI wrapper around libtorrent, designed for use in .NET applications. This wrapper allows .NET developers to leverage many of the core features of libtorrent in their projects.

Features

  • Access to common libtorrent functionality through a .NET-friendly interface
  • Easy integration with existing .NET projects targeting Windows
  • High-performance BitTorrent operations

Installation

You can install this package using the NuGet Package Manager:

Install-Package LibtorrentDotNet

Usage

Here's a basic example of how to use LibtorrentDotNet:

using LibtorrentDotNet;

class Program
{
    static void Main(string[] args)
    {
        using (var torrentSession = TorrentSession.Create())
        {
            torrentSession.TorrentStateUpdated += (sender, torrentStateUpdateEventArgs) =>
            {
                var status = torrentStateUpdateEventArgs.UpdatedTorrents[0];
                if (status.State == TorrentState.Downloading)
                {
                    Console.WriteLine($"Downloading torrent: {Math.Round(status.Progress * 100, 2)}%");
                }
                else
                {
                    Console.WriteLine(status.State);
                }
            };

            torrentSession.AddTorrent(new AddTorrentFromMagnetLinkRequest("your magnet link goes here", "a save directory path goes here"));

            Console.WriteLine("Press any key to exit.");
            Console.ReadLine();
        }
    }
}

Requirements

  • .NET 8
  • Windows 10 and later, x64 only

Building

Before building the solution, ensure that you have the following installed:

  • vcpkg
  • .NET 8 SDK
  • Visual Studio 2022 (or your preferred IDE) with the following components:
    • .NET desktop development workload
    • Desktop development with C++ workload
    • C++/CLI support for v143 build tools
  1. Install the libtorrent library using vcpkg
  2. Clone this repository
  3. Build the solution

Dependencies

This project uses the following third-party library:

libtorrent

libtorrent is a C++ library that provides a feature-complete implementation of the BitTorrent protocol.

  • Author: Arvid Norberg and contributors
  • License: BSD License
  • Copyright: (c) 2003-2024 Arvid Norberg, all rights reserved.

The libtorrent library is used to handle torrent functionalities within this project. You can find more information about libtorrent on the official website or view its source code on GitHub.

License

This project is licensed under the BSD License. For more information, see the LICENSE.txt file in the root of this repository.

This project includes or depends on libtorrent, which is subject to its own license terms. See LICENSE.txt for details.

Special Thanks

Special thanks to the open-source community and all contributors of libtorrent for providing an excellent library that made this project possible.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 91 12/7/2024
1.0.0 98 10/27/2024

Initial release