Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.25 #1197

Merged
merged 2 commits into from
Oct 11, 2024
Merged

1.25 #1197

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public DataCulling Culling
protected virtual Bitmap GetItemIcon(T value, Size size)
{
var type = value.GetType();
if (TypeIcons.TryGetValue(GetType(), out var icon))
if (TypeIcons.TryGetValue(type, out var icon))
return icon;

var bitmap = default(Bitmap);
Expand All @@ -251,19 +251,19 @@ protected virtual Bitmap GetItemIcon(T value, Size size)
{
// Try with a parameter that has the same name.
var typeName = value.TypeName;
var location = value.GetType().Assembly.Location;
var proxy = Instances.ComponentServer.ObjectProxies.
var assembly = type.Assembly;
var proxies = Instances.ComponentServer.ObjectProxies.
Where
(
x => typeof(IGH_Param).IsAssignableFrom(x.Type) &&
string.Equals(x.Desc.Name, typeName, StringComparison.OrdinalIgnoreCase) &&
string.Equals(x.Location, location, StringComparison.OrdinalIgnoreCase)
x => x.Kind == GH_ObjectType.CompiledObject &&
typeof(IGH_Param).IsAssignableFrom(x.Type) &&
Equals(x.Type?.Assembly, assembly) &&
string.Equals(x.Desc.Name, typeName, StringComparison.OrdinalIgnoreCase)
).
OrderBy(x => !x.SDKCompliant).
ThenBy(x => x.Obsolete).
FirstOrDefault();
ThenBy(x => x.Obsolete);

bitmap = proxy?.Icon;
bitmap = proxies.FirstOrDefault()?.Icon;
}

return TypeIcons[type] = bitmap;
Expand Down
9 changes: 5 additions & 4 deletions src/RhinoInside.Revit.GH/Types/Reference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ Bitmap IGH_ItemDescription.GetTypeIcon(Size size)
if (typeName.StartsWith("Revit "))
typeName = typeName.Substring(6);

var location = GetType().Assembly.Location;
var assembly = GetType().Assembly;
var proxy = Instances.ComponentServer.ObjectProxies.
Where
(
x => typeof(IGH_Param).IsAssignableFrom(x.Type) &&
string.Equals(x.Desc.Name, typeName, StringComparison.OrdinalIgnoreCase) &&
string.Equals(x.Location, location, StringComparison.OrdinalIgnoreCase)
x => x.Kind == GH_ObjectType.CompiledObject &&
typeof(IGH_Param).IsAssignableFrom(x.Type) &&
Equals(x.Type?.Assembly, assembly) &&
string.Equals(x.Desc.Name, typeName, StringComparison.OrdinalIgnoreCase)
).
OrderBy(x => !x.SDKCompliant).
ThenBy(x => x.Obsolete).
Expand Down
Loading