private static Bitmap GetPluginIcon(string typeName, Assembly a) { Stream s = null; Bitmap bmp = null; string iconName = String.Format("{0}.", typeName); string resName = String.Empty; try { string[] resNames = a.GetManifestResourceNames(); foreach (string rName in resNames) { if (rName.StartsWith(iconName)) { resName = rName; s = a.GetManifestResourceStream(resName); break; } } if (s != null) { if (PathUtils.IsIconExt(resName)) { Icon ico = new Icon(s); bmp = ico.ToBitmap(); } else { bmp = Bitmap.FromStream(s) as Bitmap; } } } catch { } finally { if (s != null) { s.Close(); s = null; } } return(bmp); }