27 lines
635 B
C#
27 lines
635 B
C#
using Foundation;
|
|
|
|
namespace Blahblah.Library.Network;
|
|
|
|
public class StringTask : ContentTask<string, string>
|
|
{
|
|
public StringHandler? Process { get; set; }
|
|
|
|
public StringTask(string url, TaskCompletionSource<NetworkResult<string>> source, CancellationToken token) : base(url, source, token)
|
|
{
|
|
}
|
|
|
|
protected override string? Completed(NSHttpUrlResponse? response)
|
|
{
|
|
if (Data == null)
|
|
{
|
|
return null;
|
|
}
|
|
string s = NSString.FromData(Data, NSStringEncoding.UTF8);
|
|
if (Process == null)
|
|
{
|
|
return s;
|
|
}
|
|
return Process(s);
|
|
}
|
|
}
|