private int GetIconIndex(AppInfo app) { if (iconIndices.ContainsKey(app.Name)) { return(iconIndices[app.Name]); } else if (app.Icon != null) { int result = iconIndices.Count; iconIndices.Add(app.Name, result); activitiesListView.SmallImageList.Images.Add(ShellIcon.ConvertIconToBitmap(app.Icon)); return(result); } else { return(-1); } }
public AppInfo GetApp(string path) { AppInfo appInfo; if (apps.ContainsKey(path)) { appInfo = apps[path]; } else { Icon icon = ShellIcon.GetSmallIcon(path); appInfo = new AppInfo { Name = Path.GetFileName(path), Path = path, Icon = icon, ColorBins = IconAnalyser.GetColors(icon) }; apps.Add(path, appInfo); } return(appInfo); }