//public HttpResult<string> LoadText(HttpRequest_v3 httpRequest) public async Task <HttpResult_v5 <string> > LoadText(HttpRequest_v5 httpRequest) { if (_httpCacheManager != null) { return(await _httpCacheManager.LoadText(httpRequest)); } else { return(await new Http_v5(httpRequest, this).LoadText()); } //return Load(httpRequest, http => http.LoadText()); //bool success = false; //try //{ //} //catch (Exception ex) //{ // if (_traceException) // Trace.WriteLine($"{DateTime.Now:dd/MM/yyyy HH:mm:ss} Error : loading \"{(httpRequest.UrlCachePath != null ? httpRequest.UrlCachePath.Path : httpRequest.Url)}\" ({httpRequest.Method}) {ex.Message}"); // else // throw; //} //return new HttpResult<string> { Success = success, LoadFromWeb = loadFromWeb, LoadFromCache = loadFromCache, Http = http, Data = data }; }
//public bool Success { get { return _success; } } //public bool LoadFromWeb { get { return _loadFromWeb; } } //public bool LoadFromCache { get { return _loadFromCache; } } //public UrlCachePathResult UrlCachePath { get { return _urlCachePath; } } //public HttpResponseMessage HttpResponse { get { return _httpResponse; } } // HttpRequestParameters requestParameters = null public Http_v5(HttpRequest_v5 request, HttpManager_v5 httpManager) { _request = request; _httpManager = httpManager; //if (requestParameters != null) // _requestParameters = requestParameters; //else // _requestParameters = new HttpRequestParameters(); }
public string GetUrlSubPath(HttpRequest_v5 httpRequest) { //string file = zurl.UrlToFileName(httpRequest, _urlFileNameType); //string file = zurl.UrlToFileName(httpRequest.Url, _urlFileNameType, httpRequestContent: httpRequest.Content); string file = zurl.UrlToFileName(httpRequest.Url, _urlFileNameType); if (!_indexedFile) { string dir = _getUrlSubDirectory_v2?.Invoke(httpRequest); if (dir != null) { file = zPath.Combine(dir, file); } } return(file); }
public virtual void Dispose() { if (_httpRequest != null) { _httpRequest.Dispose(); _httpRequest = null; } if (_httpResponse != null) { _httpResponse.Dispose(); _httpResponse = null; } if (_request != null) { _request.Dispose(); _request = null; } }
//public HttpCacheManager HttpCacheManager { get { return _httpCacheManager; } set { _httpCacheManager = value; } } public HttpCache(HttpCacheManager httpCacheManager, HttpRequest_v5 request) { _httpCacheManager = httpCacheManager; _request = request; }
public async Task <HttpResult_v5 <string> > LoadText(HttpRequest_v5 httpRequest) { return(await new HttpCache(this, httpRequest).LoadText()); }
public UrlCachePathResult GetUrlPathResult(HttpRequest_v5 httpRequest, string subDirectory = null) { return(GetUrlPathResult(GetUrlSubPath(httpRequest), subDirectory)); }
public async Task <HttpResult_v5> LoadToFile(HttpRequest_v5 httpRequest, string file) { return(await new Http_v5(httpRequest, this).LoadToFile(file)); }