Example #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int == false)
            {
                return(null);
            }

            if (_DefaultBitmap == null)
            {
                _DefaultBitmap = new BitmapImage();
                _DefaultBitmap.BeginInit();
                _DefaultBitmap.UriSource = new Uri("pack://application:,,,/SpyUO;component/Images/Missing.png");
                _DefaultBitmap.EndInit();
            }

            if (_EnhancedTexture != null)
            {
                if (Globals.Instance.EnhancedAssets == null)
                {
                    _EnhancedTexture.Clear();
                }
                else
                {
                    return(_EnhancedTexture.Get((int)value));
                }
            }
            else
            {
                if (Globals.Instance.EnhancedAssets != null)
                {
                    _EnhancedTexture         = new SimpleCache <int, TextureFile>(100);
                    _EnhancedTexture.Getter += new SimpleCacheGetter <int, TextureFile>(EnhancedTexture_Getter);
                    return(_EnhancedTexture.Get((int)value));
                }
            }

            if (_LegacyTexture != null)
            {
                if (Globals.Instance.LegacyAssets == null)
                {
                    _LegacyTexture.Clear();
                }
                else
                {
                    return(_LegacyTexture.Get((int)value));
                }
            }
            else
            {
                if (Globals.Instance.LegacyAssets != null)
                {
                    _LegacyTexture         = new SimpleCache <int, TextureFile>(100);
                    _LegacyTexture.Getter += new SimpleCacheGetter <int, TextureFile>(LegacyTexture_Getter);
                    return(_LegacyTexture.Get((int)value));
                }
            }

            return(GetDefaultTexture((int)value));
        }
Example #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int == false)
            {
                return(null);
            }

            if (_Sounds == null)
            {
                _Sounds         = new SimpleCache <int, AudioFile>(50);
                _Sounds.Getter += new SimpleCacheGetter <int, AudioFile>(Sound_Getter);
            }

            return(_Sounds.Get((int)value));
        }