# HG changeset patch
# User StephaneLenclud
# Date 1453384805 -3600
# Node ID 9eb93d079a3ec64f5429ca7dda8d58ce61afe350
# Parent c24dc0c6b64b0b26613f2526f1d77a526fe3634e
Simplify GetIcon function.
diff -r c24dc0c6b64b -r 9eb93d079a3e Server/MainForm.cs
--- a/Server/MainForm.cs Fri Jan 01 00:45:18 2016 +0100
+++ b/Server/MainForm.cs Thu Jan 21 15:00:05 2016 +0100
@@ -578,23 +578,20 @@
iNotifyIcon.ContextMenu = contextMenu;
}
- ///
- /// Access icons from embedded resources.
- ///
- ///
- ///
- public static Icon GetIcon(string name)
+ ///
+ /// Access icons from embedded resources.
+ ///
+ ///
+ ///
+ public static Icon GetIcon(string aName)
{
- name = "SharpDisplayManager.Resources." + name;
-
- string[] names =
- Assembly.GetExecutingAssembly().GetManifestResourceNames();
- for (int i = 0; i < names.Length; i++)
+ string[] names = Assembly.GetExecutingAssembly().GetManifestResourceNames();
+ foreach (string name in names)
{
- if (names[i].Replace('\\', '.') == name)
+ //Find a resource name that ends with the given name
+ if (name.EndsWith(aName))
{
- using (Stream stream = Assembly.GetExecutingAssembly().
- GetManifestResourceStream(names[i]))
+ using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name))
{
return new Icon(stream);
}