private IconData[] CreateIconData(IIcon icon, bool highRes) { if (icon == null) { throw new ArgumentNullException(nameof(icon)); } IEnumerable <IconSizeInfo> sizes = null; if (highRes) { sizes = icon.GetHighResolutionIconSizes(); } else { sizes = icon.GetIconSizes(); } if (sizes == null || !sizes.Any()) { throw new NullReferenceException($"Specified icon '{icon.GetType().FullName}' doesn't provide any sizes"); } var iconsData = sizes.Select(s => new IconData(m_IconsDir, s.SourceImage, s.TargetSize, s.Name)).ToArray(); return(iconsData); }
public string[] ConvertIcon(IIcon icon) { var sizes = icon.GetIconSizes().ToArray(); var bitmapPaths = new string[sizes.Length]; for (int i = 0; i < sizes.Length; i++) { bitmapPaths[i] = Path.Combine(IconsFolder, sizes[i].Name); CreateBitmap(new IXImage[] { sizes[i].SourceImage }, bitmapPaths[i], sizes[i].TargetSize, sizes[i].Offset, icon.TransparencyKey, sizes[i].Mask); } return(bitmapPaths); }