コード例 #1
0
        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);
        }
コード例 #2
0
        public static ImageResourceCache Default(string ImageType)
        {
            if (defaultCore == null)
            {
                defaultCore = DoLoad(ImageType);
            }

            return(defaultCore);
        }
コード例 #3
0
        public static ImageResourceCache GetChannelManager()
        {
            lock (mutex)
            {
                if (_instance == null)
                {
                    _instance = new ImageResourceCache();
                }
            }

            return(_instance);
        }