mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 00:53:51 -07:00
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2149 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
33 lines
1 KiB
C#
33 lines
1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using Greenshot.IniFile;
|
|
using GreenshotPlugin.Core;
|
|
|
|
namespace ExternalCommand {
|
|
public static class IconCache {
|
|
private static Dictionary<string, Image> iconCache = new Dictionary<string, Image>();
|
|
private static ExternalCommandConfiguration config = IniConfig.GetIniSection<ExternalCommandConfiguration>();
|
|
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(IconCache));
|
|
|
|
public static Image IconForExe(string exepath) {
|
|
if (exepath != null) {
|
|
if (!iconCache.ContainsKey(exepath)) {
|
|
Image icon = null;
|
|
if (File.Exists(config.commandlines[exepath])) {
|
|
try {
|
|
icon = PluginUtils.GetExeIcon(config.commandlines[exepath], 0);
|
|
} catch (Exception ex) {
|
|
LOG.Warn("Problem loading icon for " + config.commandlines[exepath], ex);
|
|
}
|
|
}
|
|
iconCache.Add(exepath, icon);
|
|
}
|
|
return iconCache[exepath];
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|