Exemplo n.º 1
0
 private DrapoFile GetCacheFile(string key)
 {
     for (int i = this._cacheFiles.Count - 1; i >= 0; i--)
     {
         DrapoFile file = this._cacheFiles[i];
         if (file.Key == key)
         {
             return(file);
         }
     }
     return(null);
 }
Exemplo n.º 2
0
        private DrapoFile CreateCacheFile(HttpContext context, string path, string custom, string extension, string key)
        {
            DrapoFile file = new DrapoFile();

            file.Key          = key;
            file.Path         = path;
            file.Exists       = IsRequestCustomTypeInternal(context, path, custom, extension, out string eTag, out string lastModified, out string contentData);
            file.ETag         = eTag;
            file.LastModified = lastModified;
            file.ContentData  = contentData;
            this._cacheFiles.Add(file);
            return(file);
        }
Exemplo n.º 3
0
        private async Task <DrapoDynamic> IsRequestCustomType(HttpContext context, string path, string custom, string extension, string contentType)
        {
            string    key  = string.Format("{0}{1}", custom, path);
            DrapoFile file = this.GetCacheFile(key);

            if (file == null)
            {
                file = CreateCacheFile(context, path, custom, extension, key);
            }
            if (!file.Exists)
            {
                return(null);
            }
            DrapoDynamic dynamic = new DrapoDynamic();

            dynamic.ETag         = file.ETag;
            dynamic.LastModified = file.LastModified;
            dynamic.ContentData  = file.ContentData;
            dynamic.ContentType  = contentType;
            return(await Task.FromResult <DrapoDynamic>(dynamic));
        }