This project is read-only.
To create a bencoded string:

var bencodedString = Bencode.String("String Value");

To create a bencoded integer:

var bencodedInteger = Bencode.Integer(25);

To create a bencoded list:

BencodeList bencodedList = Bencode.List(Bencode.String("First Element"), Bencode.String("Second Element"), Bencode.String("Third Element"));

To create a bencoded list using fluent syntax:

BencodeList fluentBencodedList = Bencode.List()
  .Items( items =>
    items.Add(Bencode.String("First Element"))
         .Add(Bencode.String("Second Element"))
         .Add(Bencode.String("Third Element"));

To create a bencoded dictionary:

BencodeDictionary bencodedDictionary = Bencode.Dictionary(Bencode.Pair(Bencode.String("Key1"), Bencode.Integer(1)), Bencode.Pair(Bencode.String("Key2"), Bencode.String("Two")));

To create a bencoded dictionary using fluent-syntax:

BencodeDictionary fluentBencodedDictionary = Bencode.Dictionary()
  .Entries( entries =>
    entries.Add("Key1", Bencode.Integer(12))
           .Add("Key2", Bencode.String("Value"))
           .Add(Bencode.String("Key3"), Bencode.Integer(3));

How to write a bencode element to a file:

var bencodeElement = Bencode.String("Encoded string");

How to read a bencoded file (including Torrent) into a bencode element:

BencodeElement fileDom = System.IO.File.ReadAllText(@"c:\file.torrent").ToBencodeElement();

How to read a strongly typed Torrent file:

BencodeDictionary torrentDom = System.IO.File.ReadAllText(@"c:\file.torrent").ToBencodeDictionary();;
Torrent torrentFile = new Torrent(torrentDom);

How to write a strongly typed Torrent file

Torrent torrentFile = ...

Last edited Jun 27, 2011 at 7:14 AM by ashimoon, version 7


No comments yet.