The following example demonstrates how to get information about file names and images, stored in the DevExpress Icon Collection.
Added By: Rennie Petersen at: 6/3/2016 3:54:19 PM For what it's worth, here's an alternative version that retrieves all of the icons in one run.
Added By: Alisher (DevExpress Support) at: 6/6/2016 1:01:20 AM Hi Rennie,
Thank you for sharing your implementation with us. We greatly appreciate this.Added By: Don Boitnott at: 8/17/2016 5:16:54 AM You need to change the call to GetResourceByFileName() to include the ImageType:
using (Stream str = ImageResourceCache.Default.GetResourceByFileName(imageInfo.Name, imageInfo.ImageType))
...otherwise, you get an incomplete (and seemingly random) set of images.
Question Comments
Added By: Rennie Petersen at: 6/3/2016 3:54:19 PM For what it's worth, here's an alternative version that retrieves all of the icons in one run.
[C#]usingSystem;usingSystem.IO;usingDevExpress.Images;namespaceGetIconLibrary{classProgram{staticvoidMain(string[]args){stringfilePathRoot=@"E:\Icons\DevExpress Icon Library\";foreach(ImagesAssemblyImageInfoimageInfoinImagesAssemblyImageList.Images){stringimageType=imageInfo.ImageType.ToString();stringimageSize=imageInfo.Size.ToString();stringfilePathSpecific=Path.Combine(filePathRoot,imageType,imageSize);if(!Directory.Exists(filePathSpecific)){try{Directory.CreateDirectory(filePathSpecific);}catch(Exceptione){Console.WriteLine("Can't create a directory: {0}",e.ToString());}finally{}}using(Streamstr=ImageResourceCache.Default.GetResourceByFileName(imageInfo.Name)){if(str!=null&&str.CanRead){using(FileStreamfileStream=File.Create(filePathSpecific+"\\"+imageInfo.Name)){str.CopyTo(fileStream);Console.WriteLine("Writing "+imageInfo.Name);}}}}}}}
Added By: Alisher (DevExpress Support) at: 6/6/2016 1:01:20 AM Hi Rennie,
Thank you for sharing your implementation with us. We greatly appreciate this.Added By: Don Boitnott at: 8/17/2016 5:16:54 AM You need to change the call to GetResourceByFileName() to include the ImageType:
using (Stream str = ImageResourceCache.Default.GetResourceByFileName(imageInfo.Name, imageInfo.ImageType))
...otherwise, you get an incomplete (and seemingly random) set of images.