-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathIBencodeParser.cs
More file actions
48 lines (42 loc) · 1.65 KB
/
Copy pathIBencodeParser.cs
File metadata and controls
48 lines (42 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.IO.Pipelines;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BencodeNET.IO;
using BencodeNET.Objects;
namespace BencodeNET.Parsing
{
/// <summary>
/// Represents a parser capable of parsing bencode.
/// </summary>
public interface IBencodeParser
{
/// <summary>
/// List of parsers used by the <see cref="IBencodeParser"/>.
/// </summary>
BObjectParserList Parsers { get; }
/// <summary>
/// The encoding use for parsing.
/// </summary>
Encoding Encoding { get; }
/// <summary>
/// Parses an <see cref="IBObject"/> from the reader.
/// </summary>
/// <param name="reader"></param>
IBObject Parse(BencodeReader reader);
/// <summary>
/// Parse an <see cref="IBObject"/> of type <typeparamref name="T"/> from the reader.
/// </summary>
/// <typeparam name="T">The type of <see cref="IBObject"/> to parse as.</typeparam>
/// <param name="reader"></param>
T Parse<T>(BencodeReader reader) where T : class, IBObject;
/// <summary>
/// Parse an <see cref="IBObject"/> from the <see cref="PipeReader"/>.
/// </summary>
ValueTask<IBObject> ParseAsync(PipeBencodeReader pipeReader, CancellationToken cancellationToken = default);
/// <summary>
/// Parse an <see cref="IBObject"/> of type <typeparamref name="T"/> from the <see cref="PipeBencodeReader"/>.
/// </summary>
ValueTask<T> ParseAsync<T>(PipeBencodeReader pipeReader, CancellationToken cancellationToken = default) where T : class, IBObject;
}
}