Giter Site home page Giter Site logo

ctguxp / ragnar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hexafluoride/ragnar

0.0 2.0 0.0 970 KB

A C++/CLI wrapper for libtorrent (Rasterbar)

Home Page: http://libragnar.org

Batchfile 0.02% PowerShell 3.42% C# 8.83% C++ 87.63% C 0.10%

ragnar's Introduction

Ragnar

Ragnar is a C++/CLI wrapper for Rasterbar's libtorrent. It aims to provide a (mostly) complete interface to the underlying C++ library.

Usage

1. Install the NuGet package.

PM> Install-Package Ragnar

2. Create a session

using(var session = new Session())
{
    // Make the session listen on a port in the range
    // 6881-6889
    session.ListenOn(6881, 6889);

    // Create the AddTorrentParams with info about the torrent
    // we'd like to add.
    var addParams = new AddTorrentParams
    {
        SavePath = "C:\\Downloads",
        Url = "<url to a torrent file>"
    };

    // Add a torrent to the session and get a `TorrentHandle`
    // in return.
    var handle = session.AddTorrent(addParams);

    while(true)
    {
        // Get a `TorrentStatus` instance from the handle.
        var status = handle.QueryStatus();

        // If we are seeding, our job here is done.
        if(status.IsSeeding)
        {
            break;
        }

        // Print our progress and sleep for a bit.
        Console.WriteLine("{0}% downloaded", status.Progress * 100);
        Thread.Sleep(1000);
    }
}

How to build from source

The repository includes a bootstrap.bat file which runs the run-bootstrap.ps1 script. This will download and compile both Boost and libtorrent automatically.

1. Run the bootstrap.bat file

2. Building Ragnar

Open Ragnar.sln in Visual Studio 2013. Press F6. Wait a while. Success. If not - report an issue.

Contributing

  • Fork the repository.
  • Make your feature addition or bug fix.
  • Send a pull request. Bonus for topic branches. Funny .gif will be your reward.

License

Copyright (c) 2014, Viktor Elofsson and contributors

Ragnar is provided as-is under the MIT license. For more information see LICENSE.

For Boost, see http://svn.boost.org/svn/boost/trunk/LICENSE_1_0.txt

For libtorrent, see https://libtorrent.googlecode.com/svn/trunk/LICENSE

ragnar's People

Contributors

vktr avatar patriksvensson avatar grigmin avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.