mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 05:23:24 -07:00
Added icons to the external commands editor & added a check for the OK button
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1746 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
5780560fbe
commit
cdba70d227
8 changed files with 109 additions and 22 deletions
34
GreenshotExternalCommandPlugin/IconCache.cs
Normal file
34
GreenshotExternalCommandPlugin/IconCache.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
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 = AbstractDestination.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue