Browse Source

Enhanced icon set with access/static overlays.

pull/106/head
Ed Harvey 14 years ago
parent
commit
b1f93aa36a
  1. 27
      ILSpy/ILSpy.csproj
  2. BIN
      ILSpy/Images/Class.png
  3. BIN
      ILSpy/Images/Constructor.png
  4. BIN
      ILSpy/Images/Delegate.png
  5. BIN
      ILSpy/Images/Enum.png
  6. BIN
      ILSpy/Images/EnumValue.png
  7. BIN
      ILSpy/Images/Event.png
  8. BIN
      ILSpy/Images/ExtensionMethod.png
  9. BIN
      ILSpy/Images/Field.png
  10. BIN
      ILSpy/Images/FieldReadOnly.png
  11. 275
      ILSpy/Images/Images.cs
  12. BIN
      ILSpy/Images/Indexer.png
  13. BIN
      ILSpy/Images/Interface.png
  14. BIN
      ILSpy/Images/InternalClass.png
  15. BIN
      ILSpy/Images/InternalDelegate.png
  16. BIN
      ILSpy/Images/InternalEnum.png
  17. BIN
      ILSpy/Images/InternalInterface.png
  18. BIN
      ILSpy/Images/InternalStruct.png
  19. BIN
      ILSpy/Images/Literal.png
  20. 37
      ILSpy/Images/MemberIcon.cs
  21. BIN
      ILSpy/Images/Method.png
  22. BIN
      ILSpy/Images/Operator.png
  23. 34
      ILSpy/Images/OverlayIcon.cs
  24. BIN
      ILSpy/Images/OverlayInternal.png
  25. BIN
      ILSpy/Images/OverlayPrivate.png
  26. BIN
      ILSpy/Images/OverlayProtected.png
  27. BIN
      ILSpy/Images/OverlayProtectedInternal.png
  28. BIN
      ILSpy/Images/OverlayStatic.png
  29. BIN
      ILSpy/Images/PrivateClass.png
  30. BIN
      ILSpy/Images/PrivateDelegate.png
  31. BIN
      ILSpy/Images/PrivateEnum.png
  32. BIN
      ILSpy/Images/PrivateInterface.png
  33. BIN
      ILSpy/Images/PrivateStruct.png
  34. BIN
      ILSpy/Images/Property.png
  35. BIN
      ILSpy/Images/ProtectedClass.png
  36. BIN
      ILSpy/Images/ProtectedDelegate.png
  37. BIN
      ILSpy/Images/ProtectedEnum.png
  38. BIN
      ILSpy/Images/ProtectedInterface.png
  39. BIN
      ILSpy/Images/ProtectedStruct.png
  40. BIN
      ILSpy/Images/Resource.png
  41. BIN
      ILSpy/Images/ResourceImage.png
  42. BIN
      ILSpy/Images/Struct.png
  43. BIN
      ILSpy/Images/SubTypes.png
  44. BIN
      ILSpy/Images/SuperTypes.png
  45. 31
      ILSpy/Images/TypeIcon.cs
  46. 25
      ILSpy/TreeNodes/EventTreeNode.cs
  47. 58
      ILSpy/TreeNodes/FieldTreeNode.cs
  48. 75
      ILSpy/TreeNodes/MethodTreeNode.cs
  49. 99
      ILSpy/TreeNodes/PropertyTreeNode.cs
  50. 80
      ILSpy/TreeNodes/TypeTreeNode.cs

27
ILSpy/ILSpy.csproj

@ -110,6 +110,9 @@ @@ -110,6 +110,9 @@
<Compile Include="ILAstLanguage.cs" />
<Compile Include="ILLanguage.cs" />
<Compile Include="ILSpySettings.cs" />
<Compile Include="Images\MemberIcon.cs" />
<Compile Include="Images\OverlayIcon.cs" />
<Compile Include="Images\TypeIcon.cs" />
<Compile Include="ISmartTextOutput.cs" />
<Compile Include="Language.cs" />
<Compile Include="Images\Images.cs" />
@ -201,25 +204,10 @@ @@ -201,25 +204,10 @@
<Resource Include="Images\Enum.png" />
<Resource Include="Images\Field.png" />
<Resource Include="Images\Interface.png" />
<Resource Include="Images\InternalClass.png" />
<Resource Include="Images\InternalDelegate.png" />
<Resource Include="Images\InternalEnum.png" />
<Resource Include="Images\InternalInterface.png" />
<Resource Include="Images\InternalStruct.png" />
<Resource Include="Images\Literal.png" />
<Resource Include="Images\Method.png" />
<Resource Include="Images\NameSpace.png" />
<Resource Include="Images\Open.png" />
<Resource Include="Images\PrivateClass.png" />
<Resource Include="Images\PrivateDelegate.png" />
<Resource Include="Images\PrivateEnum.png" />
<Resource Include="Images\PrivateInterface.png" />
<Resource Include="Images\PrivateStruct.png" />
<Resource Include="Images\ProtectedClass.png" />
<Resource Include="Images\ProtectedDelegate.png" />
<Resource Include="Images\ProtectedEnum.png" />
<Resource Include="Images\ProtectedInterface.png" />
<Resource Include="Images\ProtectedStruct.png" />
<Resource Include="Images\Assembly.png" />
<Resource Include="Images\Struct.png" />
<Resource Include="Images\ReferenceFolder.Closed.png" />
@ -238,6 +226,14 @@ @@ -238,6 +226,14 @@
<Resource Include="Images\Forward.png" />
<Resource Include="Images\PrivateInternal.png" />
<Resource Include="Images\Refresh.png" />
<Resource Include="Images\Constructor.png" />
<Resource Include="Images\EnumValue.png" />
<Resource Include="Images\FieldReadOnly.png" />
<Resource Include="Images\OverlayInternal.png" />
<Resource Include="Images\OverlayPrivate.png" />
<Resource Include="Images\OverlayProtected.png" />
<Resource Include="Images\OverlayProtectedInternal.png" />
<Resource Include="Images\OverlayStatic.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.csproj">
@ -261,6 +257,5 @@ @@ -261,6 +257,5 @@
<Name>ICSharpCode.TreeView</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

BIN
ILSpy/Images/Class.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 470 B

BIN
ILSpy/Images/Constructor.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

BIN
ILSpy/Images/Delegate.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 908 B

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
ILSpy/Images/Enum.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 680 B

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
ILSpy/Images/EnumValue.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

BIN
ILSpy/Images/Event.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 640 B

After

Width:  |  Height:  |  Size: 494 B

BIN
ILSpy/Images/ExtensionMethod.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

After

Width:  |  Height:  |  Size: 567 B

BIN
ILSpy/Images/Field.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 411 B

BIN
ILSpy/Images/FieldReadOnly.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

275
ILSpy/Images/Images.cs

@ -3,6 +3,9 @@ @@ -3,6 +3,9 @@
using System;
using System.Windows.Media.Imaging;
using System.Windows.Media;
using System.Windows;
using System.Collections.Generic;
namespace ICSharpCode.ILSpy
{
@ -14,61 +17,58 @@ namespace ICSharpCode.ILSpy @@ -14,61 +17,58 @@ namespace ICSharpCode.ILSpy
image.Freeze();
return image;
}
public static readonly BitmapImage ViewCode = LoadBitmap("ViewCode");
public static readonly BitmapImage Save = LoadBitmap("SaveFile");
public static readonly BitmapImage OK = LoadBitmap("OK");
public static readonly BitmapImage Delete = LoadBitmap("Delete");
public static readonly BitmapImage Search = LoadBitmap("Search");
public static readonly BitmapImage Assembly = LoadBitmap("Assembly");
public static readonly BitmapImage AssemblyWarning = LoadBitmap("AssemblyWarning");
public static readonly BitmapImage AssemblyLoading = LoadBitmap("FindAssembly");
public static readonly BitmapImage Library = LoadBitmap("Library");
public static readonly BitmapImage Namespace = LoadBitmap("NameSpace");
public static readonly BitmapImage ReferenceFolderOpen = LoadBitmap("ReferenceFolder.Open");
public static readonly BitmapImage ReferenceFolderClosed = LoadBitmap("ReferenceFolder.Closed");
public static readonly BitmapImage SubTypes = LoadBitmap("SubTypes");
public static readonly BitmapImage SuperTypes = LoadBitmap("SuperTypes");
public static readonly BitmapImage Resource = LoadBitmap("Resource");
public static readonly BitmapImage Class = LoadBitmap("Class");
public static readonly BitmapImage Struct = LoadBitmap("Struct");
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 Interface = LoadBitmap("Interface");
public static readonly BitmapImage Struct = LoadBitmap("Struct");
public static readonly BitmapImage Field = LoadBitmap("Field");
public static readonly BitmapImage Method = LoadBitmap("Method");
public static readonly BitmapImage ExtensionMethod = LoadBitmap("ExtensionMethod");
public static readonly BitmapImage Literal = LoadBitmap("Literal");
public static readonly BitmapImage Property = LoadBitmap("Property");
public static readonly BitmapImage Event = LoadBitmap("Event");
public static readonly BitmapImage Indexer = LoadBitmap("Indexer");
public static readonly BitmapImage Operator = LoadBitmap("Operator");
public static readonly BitmapImage InternalClass = LoadBitmap("InternalClass");
public static readonly BitmapImage InternalDelegate = LoadBitmap("InternalDelegate");
public static readonly BitmapImage InternalEnum = LoadBitmap("InternalEnum");
public static readonly BitmapImage InternalInterface = LoadBitmap("InternalInterface");
public static readonly BitmapImage InternalStruct = LoadBitmap("InternalStruct");
public static readonly BitmapImage PrivateClass = LoadBitmap("PrivateClass");
public static readonly BitmapImage PrivateDelegate = LoadBitmap("PrivateDelegate");
public static readonly BitmapImage PrivateEnum = LoadBitmap("PrivateEnum");
public static readonly BitmapImage PrivateInterface = LoadBitmap("PrivateInterface");
public static readonly BitmapImage PrivateStruct = LoadBitmap("PrivateStruct");
public static readonly BitmapImage ProtectedClass = LoadBitmap("ProtectedClass");
public static readonly BitmapImage ProtectedDelegate = LoadBitmap("ProtectedDelegate");
public static readonly BitmapImage ProtectedEnum = LoadBitmap("ProtectedEnum");
public static readonly BitmapImage ProtectedInterface = LoadBitmap("ProtectedInterface");
public static readonly BitmapImage ProtectedStruct = LoadBitmap("ProtectedStruct");
public static readonly BitmapImage Delete = LoadBitmap("Delete");
public static readonly BitmapImage Search = LoadBitmap("Search");
private static readonly BitmapImage Field = LoadBitmap("Field");
private static readonly BitmapImage FieldReadOnly = LoadBitmap("FieldReadOnly");
private static readonly BitmapImage Literal = LoadBitmap("Literal");
private static readonly BitmapImage EnumValue = LoadBitmap("EnumValue");
private static readonly BitmapImage Method = LoadBitmap("Method");
private static readonly BitmapImage Constructor = LoadBitmap("Constructor");
private static readonly BitmapImage Operator = LoadBitmap("Operator");
private static readonly BitmapImage ExtensionMethod = LoadBitmap("ExtensionMethod");
private static readonly BitmapImage Property = LoadBitmap("Property");
private static readonly BitmapImage Indexer = LoadBitmap("Indexer");
private static readonly BitmapImage Event = LoadBitmap("Event");
private static readonly BitmapImage OverlayProtected = LoadBitmap("OverlayProtected");
private static readonly BitmapImage OverlayInternal = LoadBitmap("OverlayInternal");
private static readonly BitmapImage OverlayProtectedInternal = LoadBitmap("OverlayProtectedInternal");
private static readonly BitmapImage OverlayPrivate = LoadBitmap("OverlayPrivate");
private static readonly BitmapImage OverlayStatic = LoadBitmap("OverlayStatic");
public static BitmapImage LoadImage(object part, string icon)
{
Uri uri;
@ -80,5 +80,202 @@ namespace ICSharpCode.ILSpy @@ -80,5 +80,202 @@ namespace ICSharpCode.ILSpy
image.Freeze();
return image;
}
private static TypeIconCache typeIconCache = new TypeIconCache();
private static MemberIconCache memberIconCache = new MemberIconCache();
public static ImageSource GetIcon(TypeIcon icon, OverlayIcon overlay)
{
return typeIconCache.GetIcon(icon, overlay, false);
}
public static ImageSource GetIcon(MemberIcon icon, OverlayIcon overlay, bool isStatic)
{
return memberIconCache.GetIcon(icon, overlay, isStatic);
}
#region icon caches & overlay management
private class TypeIconCache : IconCache<TypeIcon>
{
public TypeIconCache()
{
PreloadPublicIconToCache(TypeIcon.Class, Images.Class);
PreloadPublicIconToCache(TypeIcon.Enum, Images.Enum);
PreloadPublicIconToCache(TypeIcon.Struct, Images.Struct);
PreloadPublicIconToCache(TypeIcon.Interface, Images.Interface);
PreloadPublicIconToCache(TypeIcon.Delegate, Images.Delegate);
}
protected override ImageSource GetBaseImage(TypeIcon icon)
{
ImageSource baseImage;
switch (icon) {
case TypeIcon.Class:
baseImage = Images.Class;
break;
case TypeIcon.Enum:
baseImage = Images.Enum;
break;
case TypeIcon.Struct:
baseImage = Images.Struct;
break;
case TypeIcon.Interface:
baseImage = Images.Interface;
break;
case TypeIcon.Delegate:
baseImage = Images.Delegate;
break;
default:
throw new NotSupportedException();
}
return baseImage;
}
}
private class MemberIconCache : IconCache<MemberIcon>
{
public MemberIconCache()
{
PreloadPublicIconToCache(MemberIcon.Field, Images.Field);
PreloadPublicIconToCache(MemberIcon.FieldReadOnly, Images.FieldReadOnly);
PreloadPublicIconToCache(MemberIcon.Literal, Images.Literal);
PreloadPublicIconToCache(MemberIcon.EnumValue, Images.EnumValue);
PreloadPublicIconToCache(MemberIcon.Property, Images.Property);
PreloadPublicIconToCache(MemberIcon.Indexer, Images.Indexer);
PreloadPublicIconToCache(MemberIcon.Method, Images.Method);
PreloadPublicIconToCache(MemberIcon.Constructor, Images.Constructor);
PreloadPublicIconToCache(MemberIcon.Operator, Images.Operator);
PreloadPublicIconToCache(MemberIcon.ExtensionMethod, Images.ExtensionMethod);
PreloadPublicIconToCache(MemberIcon.Event, Images.Event);
}
protected override ImageSource GetBaseImage(MemberIcon icon)
{
ImageSource baseImage;
switch (icon) {
case MemberIcon.Field:
baseImage = Images.Field;
break;
case MemberIcon.FieldReadOnly:
baseImage = Images.FieldReadOnly;
break;
case MemberIcon.Literal:
baseImage = Images.Literal;
break;
case MemberIcon.EnumValue:
baseImage = Images.Literal;
break;
case MemberIcon.Property:
baseImage = Images.Property;
break;
case MemberIcon.Indexer:
baseImage = Images.Indexer;
break;
case MemberIcon.Method:
baseImage = Images.Method;
break;
case MemberIcon.Constructor:
baseImage = Images.Constructor;
break;
case MemberIcon.Operator:
baseImage = Images.Operator;
break;
case MemberIcon.ExtensionMethod:
baseImage = Images.ExtensionMethod;
break;
case MemberIcon.Event:
baseImage = Images.Event;
break;
default:
throw new NotSupportedException();
}
return baseImage;
}
}
private abstract class IconCache<T>
{
private Dictionary<Tuple<T, OverlayIcon, bool>, ImageSource> cache = new Dictionary<Tuple<T, OverlayIcon, bool>, ImageSource>();
protected void PreloadPublicIconToCache(T icon, ImageSource image)
{
var iconKey = new Tuple<T, OverlayIcon, bool>(icon, OverlayIcon.Public, false);
cache.Add(iconKey, image);
}
public ImageSource GetIcon(T icon, OverlayIcon overlay, bool isStatic)
{
var iconKey = new Tuple<T, OverlayIcon, bool>(icon, overlay, isStatic);
if (cache.ContainsKey(iconKey)) {
return cache[iconKey];
} else {
ImageSource result = BuildMemberIcon(icon, overlay, isStatic);
cache.Add(iconKey, result);
return result;
}
}
private ImageSource BuildMemberIcon(T icon, OverlayIcon overlay, bool isStatic)
{
ImageSource baseImage = GetBaseImage(icon);
ImageSource overlayImage = GetOverlayImage(overlay);
return CreateOverlayImage(baseImage, overlayImage, isStatic);
}
protected abstract ImageSource GetBaseImage(T icon);
private static ImageSource GetOverlayImage(OverlayIcon overlay)
{
ImageSource overlayImage;
switch (overlay) {
case OverlayIcon.Public:
overlayImage = null;
break;
case OverlayIcon.Protected:
overlayImage = Images.OverlayProtected;
break;
case OverlayIcon.Internal:
overlayImage = Images.OverlayInternal;
break;
case OverlayIcon.ProtectedInternal:
overlayImage = Images.OverlayProtectedInternal;
break;
case OverlayIcon.Private:
overlayImage = Images.OverlayPrivate;
break;
default:
throw new NotSupportedException();
}
return overlayImage;
}
private static readonly Rect iconRect = new Rect(0, 0, 16, 16);
private static ImageSource CreateOverlayImage(ImageSource baseImage, ImageSource overlay, bool isStatic)
{
var group = new DrawingGroup();
group.Children.Add(new ImageDrawing(baseImage, iconRect));
if (overlay != null) {
group.Children.Add(new ImageDrawing(overlay, iconRect));
}
if (isStatic) {
group.Children.Add(new ImageDrawing(Images.OverlayStatic, iconRect));
}
var image = new DrawingImage(group);
image.Freeze();
return image;
}
}
#endregion
}
}

BIN
ILSpy/Images/Indexer.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 500 B

BIN
ILSpy/Images/Interface.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
ILSpy/Images/InternalClass.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

BIN
ILSpy/Images/InternalDelegate.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 916 B

BIN
ILSpy/Images/InternalEnum.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 821 B

BIN
ILSpy/Images/InternalInterface.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 775 B

BIN
ILSpy/Images/InternalStruct.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 575 B

BIN
ILSpy/Images/Literal.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 586 B

37
ILSpy/Images/MemberIcon.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
namespace ICSharpCode.ILSpy
{
internal enum MemberIcon
{
Literal,
FieldReadOnly,
Field,
EnumValue,
Property,
Indexer,
Method,
Constructor,
Operator,
ExtensionMethod,
Event
}
}

BIN
ILSpy/Images/Method.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 621 B

After

Width:  |  Height:  |  Size: 532 B

BIN
ILSpy/Images/Operator.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 526 B

34
ILSpy/Images/OverlayIcon.cs

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
namespace ICSharpCode.ILSpy
{
internal enum OverlayIcon
{
Public,
Protected,
Internal,
ProtectedInternal,
Private,
}
}

BIN
ILSpy/Images/OverlayInternal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
ILSpy/Images/OverlayPrivate.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

BIN
ILSpy/Images/OverlayProtected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

BIN
ILSpy/Images/OverlayProtectedInternal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

BIN
ILSpy/Images/OverlayStatic.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

BIN
ILSpy/Images/PrivateClass.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 B

BIN
ILSpy/Images/PrivateDelegate.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 925 B

BIN
ILSpy/Images/PrivateEnum.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 845 B

BIN
ILSpy/Images/PrivateInterface.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 B

BIN
ILSpy/Images/PrivateStruct.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 B

BIN
ILSpy/Images/Property.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 B

After

Width:  |  Height:  |  Size: 746 B

BIN
ILSpy/Images/ProtectedClass.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 864 B

BIN
ILSpy/Images/ProtectedDelegate.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 937 B

BIN
ILSpy/Images/ProtectedEnum.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 784 B

BIN
ILSpy/Images/ProtectedInterface.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 753 B

BIN
ILSpy/Images/ProtectedStruct.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 556 B

BIN
ILSpy/Images/Resource.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 575 B

After

Width:  |  Height:  |  Size: 562 B

BIN
ILSpy/Images/ResourceImage.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

BIN
ILSpy/Images/Struct.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 564 B

BIN
ILSpy/Images/SubTypes.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
ILSpy/Images/SuperTypes.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

After

Width:  |  Height:  |  Size: 1.3 KiB

31
ILSpy/Images/TypeIcon.cs

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
namespace ICSharpCode.ILSpy
{
internal enum TypeIcon
{
Class,
Enum,
Struct,
Interface,
Delegate
}
}

25
ILSpy/TreeNodes/EventTreeNode.cs

@ -55,12 +55,29 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -55,12 +55,29 @@ namespace ICSharpCode.ILSpy.TreeNodes
get { return HighlightSearchMatch(ev.Name, " : " + this.Language.TypeToString(ev.EventType, false, ev)); }
}
public override object Icon {
get {
return Images.Event;
public override object Icon
{
get { return Images.GetIcon(MemberIcon.Event, GetOverlayIcon(ev.AddMethod.Attributes), ev.AddMethod.IsStatic); }
}
private static OverlayIcon GetOverlayIcon(MethodAttributes methodAttributes)
{
switch (methodAttributes & MethodAttributes.MemberAccessMask) {
case MethodAttributes.Public:
return OverlayIcon.Public;
case MethodAttributes.Assembly:
case MethodAttributes.FamANDAssem:
return OverlayIcon.Internal;
case MethodAttributes.Family:
case MethodAttributes.FamORAssem:
return OverlayIcon.Protected;
case MethodAttributes.Private:
return OverlayIcon.Private;
default:
throw new NotSupportedException();
}
}
public override FilterResult Filter(FilterSettings settings)
{
if (settings.SearchTermMatches(ev.Name) && settings.Language.ShowMember(ev))

58
ILSpy/TreeNodes/FieldTreeNode.cs

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Windows.Media;
using ICSharpCode.Decompiler;
using Mono.Cecil;
@ -28,34 +29,60 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -28,34 +29,60 @@ namespace ICSharpCode.ILSpy.TreeNodes
public sealed class FieldTreeNode : ILSpyTreeNode, IMemberTreeNode
{
readonly FieldDefinition field;
public FieldDefinition FieldDefinition {
public FieldDefinition FieldDefinition
{
get { return field; }
}
public FieldTreeNode(FieldDefinition field)
{
if (field == null)
throw new ArgumentNullException("field");
this.field = field;
}
public override object Text {
public override object Text
{
get { return HighlightSearchMatch(field.Name, " : " + this.Language.TypeToString(field.FieldType, false, field)); }
}
public override object Icon {
public override object Icon
{
get { return GetIcon(field); }
}
public static object GetIcon(FieldDefinition field)
public static ImageSource GetIcon(FieldDefinition field)
{
if (field.DeclaringType.IsEnum && !field.Attributes.HasFlag(FieldAttributes.SpecialName))
return Images.GetIcon(MemberIcon.EnumValue, GetOverlayIcon(field.Attributes), false);
if (field.IsLiteral)
return Images.Literal;
return Images.GetIcon(MemberIcon.Literal, GetOverlayIcon(field.Attributes), false);
else if (field.IsInitOnly)
return Images.GetIcon(MemberIcon.FieldReadOnly, GetOverlayIcon(field.Attributes), field.IsStatic);
else
return Images.Field;
return Images.GetIcon(MemberIcon.Field, GetOverlayIcon(field.Attributes), field.IsStatic);
}
private static OverlayIcon GetOverlayIcon(FieldAttributes fieldAttributes)
{
switch (fieldAttributes & FieldAttributes.FieldAccessMask) {
case FieldAttributes.Public:
return OverlayIcon.Public;
case FieldAttributes.Assembly:
case FieldAttributes.FamANDAssem:
return OverlayIcon.Internal;
case FieldAttributes.Family:
case FieldAttributes.FamORAssem:
return OverlayIcon.Protected;
case FieldAttributes.Private:
return OverlayIcon.Private;
default:
throw new NotSupportedException();
}
}
public override FilterResult Filter(FilterSettings settings)
{
if (settings.SearchTermMatches(field.Name) && settings.Language.ShowMember(field))
@ -63,13 +90,14 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -63,13 +90,14 @@ namespace ICSharpCode.ILSpy.TreeNodes
else
return FilterResult.Hidden;
}
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.DecompileField(field, output, options);
}
MemberReference IMemberTreeNode.Member {
MemberReference IMemberTreeNode.Member
{
get { return field; }
}
}

75
ILSpy/TreeNodes/MethodTreeNode.cs

@ -18,8 +18,7 @@ @@ -18,8 +18,7 @@
using System;
using System.Text;
using System.Windows.Media.Imaging;
using System.Windows.Media;
using ICSharpCode.Decompiler;
using Mono.Cecil;
@ -31,20 +30,23 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -31,20 +30,23 @@ namespace ICSharpCode.ILSpy.TreeNodes
public sealed class MethodTreeNode : ILSpyTreeNode, IMemberTreeNode
{
MethodDefinition method;
public MethodDefinition MethodDefinition {
public MethodDefinition MethodDefinition
{
get { return method; }
}
public MethodTreeNode(MethodDefinition method)
{
if (method == null)
throw new ArgumentNullException("method");
this.method = method;
}
public override object Text {
get {
public override object Text
{
get
{
return GetText(method, Language);
}
}
@ -62,31 +64,57 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -62,31 +64,57 @@ namespace ICSharpCode.ILSpy.TreeNodes
b.Append(language.TypeToString(method.ReturnType, false, method.MethodReturnType));
return HighlightSearchMatch(method.Name, b.ToString());
}
public override object Icon {
get {
return GetIcon(method);
}
public override object Icon
{
get { return GetIcon(method); }
}
public static BitmapImage GetIcon(MethodDefinition method)
public static ImageSource GetIcon(MethodDefinition method)
{
if (method.IsSpecialName && method.Name.StartsWith("op_", StringComparison.Ordinal))
return Images.Operator;
if (method.IsSpecialName && method.Name.StartsWith("op_", StringComparison.Ordinal)) {
return Images.GetIcon(MemberIcon.Operator, GetOverlayIcon(method.Attributes), false);
}
if (method.IsStatic && method.HasCustomAttributes) {
foreach (var ca in method.CustomAttributes) {
if (ca.AttributeType.FullName == "System.Runtime.CompilerServices.ExtensionAttribute")
return Images.ExtensionMethod;
if (ca.AttributeType.FullName == "System.Runtime.CompilerServices.ExtensionAttribute") {
return Images.GetIcon(MemberIcon.ExtensionMethod, GetOverlayIcon(method.Attributes), false);
}
}
}
return Images.Method;
if (method.IsSpecialName &&
(method.Name == ".ctor" || method.Name == ".cctor")) {
return Images.GetIcon(MemberIcon.Constructor, GetOverlayIcon(method.Attributes), false);
}
return Images.GetIcon(MemberIcon.Method, GetOverlayIcon(method.Attributes), method.IsStatic);
}
private static OverlayIcon GetOverlayIcon(MethodAttributes methodAttributes)
{
switch (methodAttributes & MethodAttributes.MemberAccessMask) {
case MethodAttributes.Public:
return OverlayIcon.Public;
case MethodAttributes.Assembly:
case MethodAttributes.FamANDAssem:
return OverlayIcon.Internal;
case MethodAttributes.Family:
case MethodAttributes.FamORAssem:
return OverlayIcon.Protected;
case MethodAttributes.Private:
return OverlayIcon.Private;
default:
throw new NotSupportedException();
}
}
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.DecompileMethod(method, output, options);
}
public override FilterResult Filter(FilterSettings settings)
{
if (settings.SearchTermMatches(method.Name) && settings.Language.ShowMember(method))
@ -94,8 +122,9 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -94,8 +122,9 @@ namespace ICSharpCode.ILSpy.TreeNodes
else
return FilterResult.Hidden;
}
MemberReference IMemberTreeNode.Member {
MemberReference IMemberTreeNode.Member
{
get { return method; }
}
}

99
ILSpy/TreeNodes/PropertyTreeNode.cs

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Windows.Media;
using ICSharpCode.Decompiler;
using Mono.Cecil;
@ -29,14 +30,16 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -29,14 +30,16 @@ namespace ICSharpCode.ILSpy.TreeNodes
{
readonly PropertyDefinition property;
readonly bool isIndexer;
readonly MethodAttributes attributesOfMostAccessibleMethod;
public PropertyTreeNode(PropertyDefinition property, bool isIndexer)
{
if (property == null)
throw new ArgumentNullException("property");
this.property = property;
this.isIndexer = isIndexer;
this.attributesOfMostAccessibleMethod = GetAttributesOfMostAccessibleMethod(this.property);
if (property.GetMethod != null)
this.Children.Add(new MethodTreeNode(property.GetMethod));
if (property.SetMethod != null)
@ -46,21 +49,90 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -46,21 +49,90 @@ namespace ICSharpCode.ILSpy.TreeNodes
this.Children.Add(new MethodTreeNode(m));
}
}
public PropertyDefinition PropertyDefinition {
get { return property; }
}
public override object Text {
public override object Text
{
get { return HighlightSearchMatch(property.Name, " : " + this.Language.TypeToString(property.PropertyType, false, property)); }
}
public override object Icon {
get {
return isIndexer ? Images.Indexer : Images.Property;
public override object Icon
{
get { return GetIcon(property); }
}
private ImageSource GetIcon(PropertyDefinition property)
{
MemberIcon icon = this.isIndexer ? MemberIcon.Indexer : MemberIcon.Property;
return Images.GetIcon(icon, GetOverlayIcon(attributesOfMostAccessibleMethod), IsStatic);
}
private static OverlayIcon GetOverlayIcon(MethodAttributes methodAttributes)
{
switch (methodAttributes & MethodAttributes.MemberAccessMask) {
case MethodAttributes.Public:
return OverlayIcon.Public;
case MethodAttributes.Assembly:
case MethodAttributes.FamANDAssem:
return OverlayIcon.Internal;
case MethodAttributes.Family:
case MethodAttributes.FamORAssem:
return OverlayIcon.Protected;
case MethodAttributes.Private:
return OverlayIcon.Private;
default:
throw new NotSupportedException();
}
}
public bool IsStatic
{
get { return (attributesOfMostAccessibleMethod & MethodAttributes.Static) != 0; }
}
private static MethodAttributes GetAttributesOfMostAccessibleMethod(PropertyDefinition property)
{
// There should always be at least one method from which to
// obtain the result, but the compiler doesn't know this so
// initialize the result with a default value
MethodAttributes result = (MethodAttributes)0;
// Method access is defined from inaccessible (lowest) to public (highest)
// in numeric order, so we can do an integer comparison of the masked attribute
int accessLevel = 0;
if (property.GetMethod != null) {
int methodAccessLevel = (int)(property.GetMethod.Attributes & MethodAttributes.MemberAccessMask);
if (accessLevel < methodAccessLevel) {
accessLevel = methodAccessLevel;
result = property.GetMethod.Attributes;
}
}
if (property.SetMethod != null) {
int methodAccessLevel = (int)(property.SetMethod.Attributes & MethodAttributes.MemberAccessMask);
if (accessLevel < methodAccessLevel) {
accessLevel = methodAccessLevel;
result = property.SetMethod.Attributes;
}
}
if (property.HasOtherMethods) {
foreach (var m in property.OtherMethods) {
int methodAccessLevel = (int)(m.Attributes & MethodAttributes.MemberAccessMask);
if (accessLevel < methodAccessLevel) {
accessLevel = methodAccessLevel;
result = m.Attributes;
}
}
}
return result;
}
public override FilterResult Filter(FilterSettings settings)
{
if (settings.SearchTermMatches(property.Name) && settings.Language.ShowMember(property))
@ -68,13 +140,14 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -68,13 +140,14 @@ namespace ICSharpCode.ILSpy.TreeNodes
else
return FilterResult.Hidden;
}
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.DecompileProperty(property, output, options);
}
MemberReference IMemberTreeNode.Member {
MemberReference IMemberTreeNode.Member
{
get { return property; }
}
}

80
ILSpy/TreeNodes/TypeTreeNode.cs

@ -129,82 +129,62 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -129,82 +129,62 @@ namespace ICSharpCode.ILSpy.TreeNodes
{
language.DecompileType(type, output, options);
}
#region Icon
enum ClassType
public override object Icon
{
Class,
Enum,
Struct,
Interface,
Delegate
get { return GetIcon(type); }
}
static ClassType GetClassType(TypeDefinition type)
public static ImageSource GetIcon(TypeDefinition type)
{
TypeIcon typeIcon = GetTypeIcon(type);
OverlayIcon overlayIcon = GetOverlayIcon(type);
return Images.GetIcon(typeIcon, overlayIcon);
}
static TypeIcon GetTypeIcon(TypeDefinition type)
{
if (type.IsValueType) {
if (type.IsEnum)
return ClassType.Enum;
return TypeIcon.Enum;
else
return ClassType.Struct;
return TypeIcon.Struct;
} else {
if (type.IsInterface)
return ClassType.Interface;
return TypeIcon.Interface;
else if (type.BaseType != null && type.BaseType.FullName == typeof(MulticastDelegate).FullName)
return ClassType.Delegate;
return TypeIcon.Delegate;
else
return ClassType.Class;
}
}
public override object Icon {
get {
return GetIcon(type);
return TypeIcon.Class;
}
}
public static ImageSource GetIcon(TypeDefinition type)
private static OverlayIcon GetOverlayIcon(TypeDefinition type)
{
OverlayIcon overlay;
switch (type.Attributes & TypeAttributes.VisibilityMask) {
case TypeAttributes.Public:
case TypeAttributes.NestedPublic:
switch (GetClassType(type)) {
case ClassType.Delegate: return Images.Delegate;
case ClassType.Enum: return Images.Enum;
case ClassType.Interface: return Images.Interface;
case ClassType.Struct: return Images.Struct;
default: return Images.Class;
}
overlay = OverlayIcon.Public;
break;
case TypeAttributes.NotPublic:
case TypeAttributes.NestedAssembly:
case TypeAttributes.NestedFamANDAssem:
switch (GetClassType(type)) {
case ClassType.Delegate: return Images.InternalDelegate;
case ClassType.Enum: return Images.InternalEnum;
case ClassType.Interface: return Images.InternalInterface;
case ClassType.Struct: return Images.InternalStruct;
default: return Images.InternalClass;
}
overlay = OverlayIcon.Internal;
break;
case TypeAttributes.NestedFamily:
case TypeAttributes.NestedFamORAssem:
switch (GetClassType(type)) {
case ClassType.Delegate: return Images.ProtectedDelegate;
case ClassType.Enum: return Images.ProtectedEnum;
case ClassType.Interface: return Images.ProtectedInterface;
case ClassType.Struct: return Images.ProtectedStruct;
default: return Images.ProtectedClass;
}
overlay = OverlayIcon.Protected;
break;
case TypeAttributes.NestedPrivate:
switch (GetClassType(type)) {
case ClassType.Delegate: return Images.PrivateDelegate;
case ClassType.Enum: return Images.PrivateEnum;
case ClassType.Interface: return Images.PrivateInterface;
case ClassType.Struct: return Images.PrivateStruct;
default: return Images.PrivateClass;
}
overlay = OverlayIcon.Private;
break;
default:
throw new NotSupportedException();
}
return overlay;
}
#endregion

Loading…
Cancel
Save