diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2020-01-15 19:14:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-15 19:14:24 +0300 |
commit | b83c9355046f0da436f68872d449049c377574cb (patch) | |
tree | a401445cebe823c875e6b398d92b94163422c986 /main/src | |
parent | 1c2c042a17a46e36167809ed9ec83ed47018377d (diff) | |
parent | 627c056def02c66607ec00ee116d4e8ce71d558f (diff) |
Merge pull request #9546 from mono/improve-image-loader
[Ide] Improve ImageService.CustomImageLoader
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs index b1dc79a125..cd1b75f497 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs @@ -913,7 +913,7 @@ namespace MonoDevelop.Ide class CustomImageLoader : Xwt.Drawing.IImageLoader { RuntimeAddin addin; - Dictionary<System.Reflection.Assembly, string []> resources = new Dictionary<System.Reflection.Assembly, string[]> (); + static Dictionary<System.Reflection.Assembly, List<string>> resources = new Dictionary<System.Reflection.Assembly, List<string>> (); public CustomImageLoader (RuntimeAddin addin) { @@ -924,11 +924,12 @@ namespace MonoDevelop.Ide { var r = addin.GetResourceInfo (fileName); - string [] resourceList; - if (!resources.TryGetValue (r.ReferencedAssembly, out resourceList)) - resourceList = resources [r.ReferencedAssembly] = r.ReferencedAssembly.GetManifestResourceNames (); + if (!resources.TryGetValue (r.ReferencedAssembly, out var resourceList)) { + resourceList = resources [r.ReferencedAssembly] = r.ReferencedAssembly.GetManifestResourceNames ().ToList (); + resourceList.Sort (); // sort resources by name + } - return resourceList; + return resourceList.Where (r => r.StartsWith (baseName) && r.EndsWith (ext)); } public Stream LoadImage (string fileName) |