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