public LibraryImage GetImage(string path, bool canBeProcessed, BaseItem item) { LibraryImage image = null; bool cached = false; lock(cache){ cached = cache.TryGetValue(path, out image); } if (!cached && image == null) { try { foreach (var resolver in Kernel.Instance.ImageResolvers) { image = resolver(path, canBeProcessed, item); if (image != null) break; } if (image == null) { image = new FilesystemImage(); } image.Path = path; image.Init(canBeProcessed, item); } catch (Exception ex) { Logger.ReportException("Failed to load image: " + path + " ", ex); image = null; } } lock (cache) { cache[path] = image; } return image; }
public LibraryImage GetImage(string path) { LibraryImage image = null; bool cached = false; lock(cache){ cached = cache.TryGetValue(path, out image); } if (!cached && image == null) { try { foreach (var resolver in Kernel.Instance.ImageResolvers) { image = resolver(path); if (image != null) break; } if (image == null) { image = new FilesystemImage(); } image.Path = path; image.Init(); // this will trigger a download a resize image.EnsureImageSizeInitialized(); } catch (Exception ex) { Logger.ReportException("Failed to load image: " + path + " ", ex); image = null; } } lock (cache) { cache[path] = image; } return image; }