public void Dispose() { if (!_isDisposed) { Bytes = _zeroLengthBytes; Argument = new HttpClientArgument(); _handler = null; _isDisposed = true; Error = null; } }
private HttpClient(HttpClientArgument argument, Action <HttpClient> handler) { Url = argument.Url; if (argument.Timeout <= 0) { argument.Timeout = _kDefaultTimeout; } Argument = argument; Bytes = _zeroLengthBytes; _handler = handler; ThreadPool.QueueUserWorkItem(_lpfnThreadDownload); }
private void _OnExitDownload() { Argument = new HttpClientArgument { Url = Argument.Url, Timeout = Argument.Timeout, Param1 = Argument.Param1, ThreadDecompressor = null, PostData = null, }; IsDone = true; Progress = 1f; if (_handler != null) { Loom.QueueOnMainThread(() => { CallbackTools.Handle(ref _handler, this, "[HttpClient:_OnExitDownload()]"); }); } }
public static HttpClient TryDownload(HttpClientArgument argument, Action <HttpClient> handler) { return(new HttpClient(argument, handler)); }