Пример #1
0
        public static FDImage ExtractIconIfNecessary(string file)
        {
            string extension = Path.GetExtension(file);

            if (extensionIcons.ContainsKey(extension))
            {
                return(extensionIcons[extension]);
            }
            else
            {
                Icon  icon  = IconExtractor.GetFileIcon(file, true);
                Image image = ImageKonverter.ImageResize(icon.ToBitmap(), 16, 16);
                icon.Dispose(); imageList.Images.Add(image);
                int     index   = imageList.Images.Count - 1; // of the icon we just added
                FDImage fdImage = new FDImage(image, index);
                extensionIcons.Add(extension, fdImage);
                return(fdImage);
            }
        }