![]() ![]() Visual Studio 2019 (or other IDE support.The project is in maintenance mode and no new features are currently planned.įeel free to request new features by creating a new issue. See CHANGELOG.md for any yet unreleased changes and changes made between different version. This way you are able to add to or owerwrite fields. The ExtraFields property is for any non-standard fields which are not accessible through any other property.ĭata set on this property will overwrite any data from the Torrent itself when encoding it. The property FileMode indicates if the torrent is single-file or multi-file.įor single-file torrents the File property contains the relevant file info.įor multi-file torrents the Files property contains a list of file info and the directory name. GetMagnetLink ( ) // magnet:?xt=urn:btih:1CA512A4822EDC7C1B1CE354D7B8D2F84EE11C32&dn=&tr= // Convert Torrent to its BDictionary representation BDictionary bdictinoary = torrent. GetInfoHashBytes ( ) // Get Magnet link string magnetLink = torrent. GetInfoHash ( ) // "B415C913643E5FF49FE37D304BBB5E6E11AD5101" // or as bytes instead of a string byte infoHashBytes = torrent. Parse (stream ) // Calculate the info hash string infoHash = torrent. Parse ( "C: \\ubuntu.torrent " ) // Or parse a stream Torrent torrent = parser. Torrents // Parse torrent by specifying the file path var parser = new BencodeParser ( ) // Default encoding is Encoding.UTF8, but you can specify another if you need to Torrent torrent = parser. ![]() Note: Using EncodeAsString of BList and BDictionary will encode all contained BString using the specified encoding or Encoding.UTF8 if no encoding is specified. However, when encoding to a string ( IBObject.EncodeAsString) you can specify the encoding used to render the string.īString.EncodeAsString without specifying an encoding will use the encoding the BString was created with.įor all the other types Encoding.UTF8 will be used. The BStrings are converted to bytes when created, using the specified encoding at the time. When you encode an object directly to a stream ( IBObject.EncodeTo) the encoding is irrelevant as The default encoding, UTF8, should be fine in almost all cases. GetEncoding ( "ISO-8859-1 " ) ) bstring = parser. GetEncoding ( "ISO-8859-1 " ) ) // "æøå äö èéê ñ" // You have to specify the used encoding when creating the parser // BStrings will then use that as the default when encoding the string var parser = new BencodeParser (Encoding. ToString ( ) // "?" // Pass your desired encoding to ToString to override the encoding used to render the stringīstring. GetBytes ( "12:æøå äö èéê ñ " ) // When not specifying an encoding, ToString will use Encoding.UTF8 var parser = new BencodeParser ( ) var bstring = parser. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |