AcManager.Controls.Converters.CountryIdToImageConverter.Convert C# (CSharp) Метод

Convert() приватный Метод

private Convert ( [ id ) : BitmapImage
id [
Результат System.Windows.Media.Imaging.BitmapImage
        public BitmapImage Convert([CanBeNull] string id) {
            if (id == null) id = @"_";

            BitmapImage bi;
            if (Cache.TryGetValue(id, out bi)) return bi;

            if (_archive == null) {
                _archive = new ZipArchive(new MemoryStream(BinaryResources.Flags));
            }

            var entryStream = (_archive.GetEntry(id) ?? _archive.GetEntry(@"_"))?.Open();
            if (entryStream == null) {
                return null;
            }

            bi = new BitmapImage();
            bi.BeginInit();
            bi.CacheOption = BitmapCacheOption.OnLoad;
            bi.StreamSource = entryStream.ReadAsMemoryStream();
            bi.EndInit();
            bi.Freeze();

            Cache[id] = bi;
            return bi;
        }

Same methods

CountryIdToImageConverter::Convert ( object value, Type targetType, object parameter, CultureInfo culture ) : object
CountryIdToImageConverter