示例#1
0
 public void Dispose()
 {
     if (!_isDisposed)
     {
         Bytes       = _zeroLengthBytes;
         Argument    = new HttpClientArgument();
         _handler    = null;
         _isDisposed = true;
         Error       = null;
     }
 }
示例#2
0
 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);
 }
示例#3
0
 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()]");
         });
     }
 }
示例#4
0
 public static HttpClient TryDownload(HttpClientArgument argument, Action <HttpClient> handler)
 {
     return(new HttpClient(argument, handler));
 }