public static ImageResourceCache DoLoad(string ImageType) { ImageResourceCache cache = GetChannelManager(); cache.resources.Clear(); cache.resourcesByFileName.Clear(); using (ResourceReader reader = DoLoadResourceReader()) { IDictionaryEnumerator e = reader.GetEnumerator(); string[] parts; string key, category; while (e.MoveNext()) { key = e.Key as string; parts = Split(key); if (parts[0] == ImageType.ToLower()) { cache.resources.Add(key, (Stream)e.Value); category = parts[1]; key = parts[0] + @"\" + parts[parts.Length - 1]; if (!cache.resourcesByFileName.ContainsKey(key)) { cache.resourcesByFileName.Add(key, (Stream)e.Value); } continue; } } } return(cache); }
public static ImageResourceCache Default(string ImageType) { if (defaultCore == null) { defaultCore = DoLoad(ImageType); } return(defaultCore); }
public static ImageResourceCache GetChannelManager() { lock (mutex) { if (_instance == null) { _instance = new ImageResourceCache(); } } return(_instance); }