You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

15 years ago
  1. // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
  2. // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
  3. using System;
  4. using ICSharpCode.TreeView;
  5. using Mono.Cecil;
  6. namespace ICSharpCode.ILSpy
  7. {
  8. /// <summary>
  9. /// Tree Node representing a field, method, property, or event.
  10. /// </summary>
  11. public sealed class MethodTreeNode : SharpTreeNode
  12. {
  13. MethodDefinition method;
  14. public MethodTreeNode(MethodDefinition method)
  15. {
  16. if (method == null)
  17. throw new ArgumentNullException("method");
  18. this.method = method;
  19. }
  20. public override object Text {
  21. get { return method.Name; }
  22. }
  23. public override object Icon {
  24. get {
  25. switch (method.Attributes & MethodAttributes.MemberAccessMask) {
  26. case MethodAttributes.Public:
  27. return Images.Method;
  28. case MethodAttributes.Assembly:
  29. case MethodAttributes.FamANDAssem:
  30. return Images.InternalMethod;
  31. case MethodAttributes.Family:
  32. case MethodAttributes.FamORAssem:
  33. return Images.ProtectedMethod;
  34. default:
  35. return Images.PrivateMethod;
  36. }
  37. }
  38. }
  39. }
  40. }