示例#1
0
        public static ImageCache Create(string imagesPath)
        {
            string cacheFile = GetCacheFile(imagesPath);

            ImageCache cache = ImageCache.Load(cacheFile);

            if (cache != null)
            {
                return(cache);
            }
            cache = new ImageCache(imagesPath);
            cache.Save(cacheFile);
            return(cache);
        }
示例#2
0
        public static UploadedImages FromSession(string routeName)
        {
            string         key  = GetKey(routeName);
            UploadedImages list = HttpContext.Current.Session[key] as UploadedImages;

            if (list == null)
            {
                list = new UploadedImages();
                HttpContext.Current.Session[key] = list;
                //carico i file già presenti su file system
                ImageCache cache = Helper.GetImageCache(PathFunctions.GetImagePathFromRouteName(routeName));
                for (int i = 0; i < cache.files.Length; i++)
                {
                    UploadedImage img = new UploadedImage(
                        cache.files[i],
                        cache.captions[i]
                        );
                    list.Add(img);
                }
            }
            return(list);
        }