Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVsevolod Kukol <sevoku@microsoft.com>2020-01-23 18:11:55 +0300
committerVsevolod Kukol <sevoku@microsoft.com>2020-01-23 18:26:32 +0300
commitf5db8837d0a1edaa84d7915e3745266482990b3f (patch)
tree0b93f21c041f19e6dc8ce4d1856b9a2a0c5b90c1
parent11fd096a3d2c6db5e2a6e88526cf135b6ce5080e (diff)
[Ide] Avoid one string allocation in CustomImageLoader
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
index 7bdc877de1..88f9c7d9ce 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
@@ -938,10 +938,14 @@ namespace MonoDevelop.Ide
if (name.StartsWith (baseName) && name.EndsWith (ext)) {
yield return name;
- var tagPortion = name.Substring (baseName.Length, name.Length - baseName.Length - ext.Length);
// to avoid duplicate resource entries in project files, add virtual file mappings for
- // high contrast icons in selected state
- if (tagPortion == "~dark~sel" || tagPortion == "~dark~sel@2x") {
+ // high contrast icons in selected state.
+ // note: we include the "." to ensure that we match "~dark~sel" exactly and not "~dark~sel~xyz".
+ int start = baseName.Length;
+ int length = name.Length - baseName.Length - ext.Length + 1;
+ if (name.IndexOf ("~dark~sel.", start, length, StringComparison.Ordinal) == start ||
+ name.IndexOf ("~dark~sel@2x.", start, length, StringComparison.Ordinal) == start)
+ {
var map = name.Replace ("~dark~sel", "~contrast~dark~sel");
if (virtualMappings == null) {
virtualMappings = new Dictionary<string, string> ();