Skip to content

Instantly share code, notes, and snippets.

@thiagodelgado111
Created July 16, 2014 17:13
Show Gist options
  • Save thiagodelgado111/e677eb0c8b8267d59dc8 to your computer and use it in GitHub Desktop.
Save thiagodelgado111/e677eb0c8b8267d59dc8 to your computer and use it in GitHub Desktop.
var bencode = new Bencode();
bencode.Encoding.Encode(1); //"i1e"
bencode.Encoding.Encode([1,2,3, {"Test" : 123} ]); //"li1ei2ei3ed4:Testi123eee"
bencode.Encoding.Encode("Test"); //"4:Test"
bencode.Encoding.Encode(-1), //"i-1e"
bencode.Encoding.Encode(0); //"i0e"
bencode.Encoding.Encode(01); //"i1e" `
bencode.Decoding.Decode("i10e"); //10
bencode.Decoding.Decode("4:Test"); //"Test
bencode.Decoding.Decode("li1ei2ei3ed4:Testi123eee"); //[1,2,3, {"Test" : 123} ]
bencode.Decoding.Decode("l4:teste"); //["test"]
bencode.Decoding.Decode("d4:testi1e4:testi10ee"); //{test : 10, test : 1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment