mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-11-13 18:36:11 +00:00
Add project files.
This commit is contained in:
38
Lantean.QBitTorrentClient/FormUrlEncodedBuilder.cs
Normal file
38
Lantean.QBitTorrentClient/FormUrlEncodedBuilder.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
namespace Lantean.QBitTorrentClient
|
||||
{
|
||||
public class FormUrlEncodedBuilder
|
||||
{
|
||||
private readonly IList<KeyValuePair<string, string>> _parameters;
|
||||
|
||||
public FormUrlEncodedBuilder()
|
||||
{
|
||||
_parameters = [];
|
||||
}
|
||||
|
||||
public FormUrlEncodedBuilder(IList<KeyValuePair<string, string>> parameters)
|
||||
{
|
||||
_parameters = parameters;
|
||||
}
|
||||
|
||||
public FormUrlEncodedBuilder Add(string key, string value)
|
||||
{
|
||||
_parameters.Add(new KeyValuePair<string, string>(key, value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public FormUrlEncodedBuilder AddIfNotNullOrEmpty(string key, string value)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
_parameters.Add(new KeyValuePair<string, string>(key, value));
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public FormUrlEncodedContent ToFormUrlEncodedContent()
|
||||
{
|
||||
return new FormUrlEncodedContent(_parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user