Skip to content

Commit

Permalink
optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
zeusongit committed Feb 20, 2024
1 parent a1c0dc2 commit 1df16dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/DynamoCoreWpf/Services/IconServices.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
Expand Down Expand Up @@ -67,8 +67,9 @@ internal IconWarehouse(Assembly resAssembly)

internal ImageSource LoadIconInternal(string iconKey)
{
if (cachedIcons.ContainsKey(iconKey))
return cachedIcons[iconKey];
ImageSource icon;
if (cachedIcons.TryGetValue(iconKey, out icon))
return icon;

if (resourceAssembly == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ public string GetResourceAsString(string url, out string extension)
url = url?.Replace("about:", string.Empty);
}

if (!String.IsNullOrEmpty(url) && urlToBase64DataCache.ContainsKey(url))
Tuple<string, string> tmpUrl = null;
if (!String.IsNullOrEmpty(url) && urlToBase64DataCache.TryGetValue(url, out tmpUrl))
{
var cachedData = urlToBase64DataCache[url];
var cachedData = tmpUrl;
extension = cachedData.Item2;
return cachedData.Item1;
}
Expand Down

0 comments on commit 1df16dd

Please sign in to comment.