Beispiel #1
0
        private void OnFinishRequest(HttpRequester req)
        {
            if (req.Error != null)
            {
                OnError(this, req.Error.Message);
            }

            if (req.DataBytes == null)
            {
                OnError(this, "Null request data: {0}", req.Url);
            }
            else
            {
                Md5String = Encoding.UTF8.GetString(req.DataBytes);

                var fileMd5 = Md5Helper.Md5File(_downloader.GetSavePath());
                if (fileMd5.ToLower() != Md5String.ToLower())
                {
                    OnError(this, "Md5 verify failed! Need: {0}, But: {1}, File: {2}", fileMd5, Md5String,
                            _downloader.GetSavePath());
                }
            }

            req.Dispose();
            Finish();
        }
Beispiel #2
0
        /// <summary>
        ///     After finish Http request the file version file
        /// </summary>
        /// <param name="req"></param>
        protected void OnFninshedRequest(HttpRequester req)
        {
            if (req.Error != null)
            {
                OnError(this, req.Error.Message);
            }
            else
            {
                var bytes = req.DataBytes;
                if (bytes != null && bytes.Length > 0)
                {
                    Result = int.Parse(Encoding.UTF8.GetString(req.DataBytes));
                }
                else
                {
                    OnError(this, "Error bytes!!! {0}", bytes);
                }
            }


            // release
            req.Dispose();

            Finish();
        }
 public void Dispose()
 {
     _httpRequester?.Dispose();
 }
 public void Dispose()
 {
     _httpRequester?.Dispose();
     GC.SuppressFinalize(this);
 }