Browse Source

Add tree node icon for Static Class.

pull/170/head
Ed Harvey 14 years ago
parent
commit
637a91236c
  1. 2
      ILSpy/ILSpy.csproj
  2. 5
      ILSpy/Images/Images.cs
  3. BIN
      ILSpy/Images/StaticClass.png
  4. 3
      ILSpy/Images/TypeIcon.cs
  5. 18
      ILSpy/TreeNodes/TypeTreeNode.cs

2
ILSpy/ILSpy.csproj

@ -236,6 +236,7 @@ @@ -236,6 +236,7 @@
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Class.png" />
<Resource Include="Images\StaticClass.png" />
<Resource Include="Images\Delegate.png" />
<Resource Include="Images\Enum.png" />
<Resource Include="Images\Field.png" />
@ -303,6 +304,5 @@ @@ -303,6 +304,5 @@
<Name>ICSharpCode.TreeView</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

5
ILSpy/Images/Images.cs

@ -65,6 +65,7 @@ namespace ICSharpCode.ILSpy @@ -65,6 +65,7 @@ namespace ICSharpCode.ILSpy
public static readonly BitmapImage Interface = LoadBitmap("Interface");
public static readonly BitmapImage Delegate = LoadBitmap("Delegate");
public static readonly BitmapImage Enum = LoadBitmap("Enum");
public static readonly BitmapImage StaticClass = LoadBitmap("StaticClass");
public static readonly BitmapImage Field = LoadBitmap("Field");
@ -133,6 +134,7 @@ namespace ICSharpCode.ILSpy @@ -133,6 +134,7 @@ namespace ICSharpCode.ILSpy
PreloadPublicIconToCache(TypeIcon.Struct, Images.Struct);
PreloadPublicIconToCache(TypeIcon.Interface, Images.Interface);
PreloadPublicIconToCache(TypeIcon.Delegate, Images.Delegate);
PreloadPublicIconToCache(TypeIcon.StaticClass, Images.StaticClass);
}
protected override ImageSource GetBaseImage(TypeIcon icon)
@ -154,6 +156,9 @@ namespace ICSharpCode.ILSpy @@ -154,6 +156,9 @@ namespace ICSharpCode.ILSpy
case TypeIcon.Delegate:
baseImage = Images.Delegate;
break;
case TypeIcon.StaticClass:
baseImage = Images.StaticClass;
break;
default:
throw new NotSupportedException();
}

BIN
ILSpy/Images/StaticClass.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

3
ILSpy/Images/TypeIcon.cs

@ -26,6 +26,7 @@ namespace ICSharpCode.ILSpy @@ -26,6 +26,7 @@ namespace ICSharpCode.ILSpy
Enum,
Struct,
Interface,
Delegate
Delegate,
StaticClass
}
}

18
ILSpy/TreeNodes/TypeTreeNode.cs

@ -146,8 +146,10 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -146,8 +146,10 @@ namespace ICSharpCode.ILSpy.TreeNodes
} else {
if (type.IsInterface)
return TypeIcon.Interface;
else if (type.BaseType != null && type.BaseType.FullName == typeof(MulticastDelegate).FullName)
else if (IsDelegate(type))
return TypeIcon.Delegate;
else if (IsStaticClass(type))
return TypeIcon.StaticClass;
else
return TypeIcon.Class;
}
@ -178,6 +180,20 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -178,6 +180,20 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
return overlay;
}
private static bool IsDelegate(TypeDefinition type)
{
return type.BaseType != null && type.BaseType.FullName == typeof(MulticastDelegate).FullName;
}
private static bool IsStaticClass(TypeDefinition type)
{
if(type.IsSealed)
return !type.Methods.Where(m => m.Name == ".ctor").Any(m => !m.IsPrivate);
return false;
}
#endregion
MemberReference IMemberTreeNode.Member {

Loading…
Cancel
Save