public Bitmap GetNormalBitmap(Rectangle section, bool flipX = false, bool flipY = false) { Bitmap bmp; if (StandardCache.TryGetValue(new CacheKey(section, flipX, flipY), out bmp)) { return(bmp); } else { if (StandardBitmap == null) { Reload(PaletteDataPath); } bmp = CropImage(StandardBitmap, section); if (flipX) { bmp.RotateFlip(RotateFlipType.RotateNoneFlipX); } if (flipY) { bmp.RotateFlip(RotateFlipType.RotateNoneFlipY); } StandardCache.Add(new CacheKey(section, flipX, flipY), bmp); return(bmp); } }
private void DisposeCache() { if (null == StandardCache) { return; } foreach (Bitmap b in StandardCache.Values) { b?.Dispose(); } StandardCache.Clear(); }
public WonkaRefStandard GetStandardByStdName(string psStdName) { return(StandardCache.Where(x => x.StandardName == psStdName).FirstOrDefault()); }
/// <summary> /// 页面缓存 /// </summary> /// <param name="standard">标准缓存类型</param> public PageCacheAttribute(StandardCache standard) { }
/// <summary> /// 页面缓存 /// </summary> /// <param name="standard">标准缓存类型</param> /// <param name="minutes">缓存时间</param> public PageCacheAttribute(StandardCache standard, int minutes) { }
private static StandardCache GetStandardCache() { var standardCache = new StandardCache(); return(standardCache); }