예제 #1
0
        //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 };
        }
예제 #2
0
        //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();
        }
예제 #3
0
        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);
        }
예제 #4
0
 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;
     }
 }
예제 #5
0
파일: HttpCache.cs 프로젝트: 24/source_04
 //public HttpCacheManager HttpCacheManager { get { return _httpCacheManager; } set { _httpCacheManager = value; } }
 public HttpCache(HttpCacheManager httpCacheManager, HttpRequest_v5 request)
 {
     _httpCacheManager = httpCacheManager;
     _request          = request;
 }
예제 #6
0
파일: HttpCache.cs 프로젝트: 24/source_04
 public async Task <HttpResult_v5 <string> > LoadText(HttpRequest_v5 httpRequest)
 {
     return(await new HttpCache(this, httpRequest).LoadText());
 }
예제 #7
0
 public UrlCachePathResult GetUrlPathResult(HttpRequest_v5 httpRequest, string subDirectory = null)
 {
     return(GetUrlPathResult(GetUrlSubPath(httpRequest), subDirectory));
 }
예제 #8
0
 public async Task <HttpResult_v5> LoadToFile(HttpRequest_v5 httpRequest, string file)
 {
     return(await new Http_v5(httpRequest, this).LoadToFile(file));
 }