Пример #1
0
            private IBitmap BuildMemberIcon(T icon, AccessOverlayIcon overlay, bool isStatic)
            {
                IBitmap baseImage    = GetBaseImage(icon);
                IBitmap overlayImage = GetOverlayImage(overlay);

                return(CreateOverlayImage(baseImage, overlayImage, isStatic));
            }
Пример #2
0
            private ImageSource BuildMemberIcon(T icon, AccessOverlayIcon overlay, bool isStatic)
            {
                ImageSource baseImage    = GetBaseImage(icon);
                ImageSource overlayImage = GetOverlayImage(overlay);

                return(CreateOverlayImage(baseImage, overlayImage, isStatic));
            }
Пример #3
0
            private static ImageSource GetOverlayImage(AccessOverlayIcon overlay)
            {
                ImageSource overlayImage;

                switch (overlay)
                {
                case AccessOverlayIcon.Public:
                    overlayImage = null;
                    break;

                case AccessOverlayIcon.Protected:
                    overlayImage = Images.OverlayProtected;
                    break;

                case AccessOverlayIcon.Internal:
                    overlayImage = Images.OverlayInternal;
                    break;

                case AccessOverlayIcon.ProtectedInternal:
                    overlayImage = Images.OverlayProtectedInternal;
                    break;

                case AccessOverlayIcon.Private:
                    overlayImage = Images.OverlayPrivate;
                    break;

                case AccessOverlayIcon.CompilerControlled:
                    overlayImage = Images.OverlayCompilerControlled;
                    break;

                default:
                    throw new NotSupportedException();
                }
                return(overlayImage);
            }
Пример #4
0
        ImageSource GetOverlayedImage(EventDefinition eventDef, MemberIcon icon)
        {
            bool isStatic = false;
            AccessOverlayIcon overlayIcon = AccessOverlayIcon.Public;

            return(Images.GetIcon(icon, overlayIcon, isStatic));
        }
Пример #5
0
        public static ImageSource GetIcon(TypeDefinition type)
        {
            TypeIcon          typeIcon    = GetTypeIcon(type);
            AccessOverlayIcon overlayIcon = GetOverlayIcon(type);

            return(Images.GetIcon(typeIcon, overlayIcon));
        }
Пример #6
0
        ImageSource GetOverlayedImage(FieldDefinition fieldDef, MemberIcon icon)
        {
            bool isStatic = false;
            AccessOverlayIcon overlayIcon = AccessOverlayIcon.Public;

            if (fieldDef.IsPrivate)
            {
                overlayIcon = AccessOverlayIcon.Private;
            }
            else if (fieldDef.IsAssembly || fieldDef.IsFamilyAndAssembly)
            {
                overlayIcon = AccessOverlayIcon.Internal;
            }
            else if (fieldDef.IsFamily)
            {
                overlayIcon = AccessOverlayIcon.Protected;
            }
            else if (fieldDef.IsFamilyOrAssembly)
            {
                overlayIcon = AccessOverlayIcon.ProtectedInternal;
            }
            else if (fieldDef.IsPublic)
            {
                overlayIcon = AccessOverlayIcon.Public;
            }

            if (fieldDef.IsStatic)
            {
                isStatic = true;
            }

            return(Images.GetIcon(icon, overlayIcon, isStatic));
        }
Пример #7
0
        ImageSource GetOverlayedImage(PropertyDefinition propDef, MemberIcon icon)
        {
            bool isStatic = false;
            AccessOverlayIcon overlayIcon = AccessOverlayIcon.Public;

            return(Images.GetIcon(propDef.IsIndexer() ? MemberIcon.Indexer : icon, overlayIcon, isStatic));
        }
Пример #8
0
 public static ImageSource GetIcon(MemberIcon icon, AccessOverlayIcon overlay, bool isStatic)
 {
     lock (memberIconCache)
     {
         return(memberIconCache.GetIcon(icon, overlay, isStatic));
     }
 }
Пример #9
0
 public static ImageSource GetIcon(TypeIcon icon, AccessOverlayIcon overlay)
 {
     lock (typeIconCache)
     {
         return(typeIconCache.GetIcon(icon, overlay, false));
     }
 }
Пример #10
0
        internal ImageSource GetOverlayedImage(TypeDefinition typeDef)
        {
            TypeIcon icon = TypeIcon.Class;

            if (typeDef.IsEnum)
            {
                icon = TypeIcon.Enum;
            }
            if (typeDef.IsValueType)
            {
                icon = TypeIcon.Struct;
            }
            if (typeDef.IsInterface)
            {
                icon = TypeIcon.Interface;
            }
            if (typeDef.BaseType.FullName == "System.MulticastDelegate" || typeDef.BaseType.FullName == "System.Delegate")
            {
                icon = TypeIcon.Delegate;
            }

            bool isStatic = false;
            AccessOverlayIcon overlayIcon = AccessOverlayIcon.Private;

            if (typeDef.IsNestedPrivate)
            {
                overlayIcon = AccessOverlayIcon.Public;
            }
            else if (typeDef.IsNestedAssembly || typeDef.IsNestedFamilyAndAssembly || typeDef.IsNotPublic)
            {
                overlayIcon = AccessOverlayIcon.Internal;
            }
            else if (typeDef.IsNestedFamily)
            {
                overlayIcon = AccessOverlayIcon.Protected;
            }
            else if (typeDef.IsNestedFamilyOrAssembly)
            {
                overlayIcon = AccessOverlayIcon.ProtectedInternal;
            }
            else if (typeDef.IsPublic || typeDef.IsNestedPublic)
            {
                overlayIcon = AccessOverlayIcon.Public;
            }

            if (typeDef.IsAbstract && typeDef.IsSealed)
            {
                isStatic = true;
            }

            return(Images.GetIcon(icon, overlayIcon, isStatic));
        }
Пример #11
0
            public ImageSource GetIcon(T icon, AccessOverlayIcon overlay, bool isStatic)
            {
                var iconKey = new Tuple <T, AccessOverlayIcon, bool>(icon, overlay, isStatic);

                if (cache.ContainsKey(iconKey))
                {
                    return(cache[iconKey]);
                }
                var result = BuildMemberIcon(icon, overlay, isStatic);

                cache.Add(iconKey, result);
                return(result);
            }
Пример #12
0
        public static ImageSource GetTypeIcon(TypeInfo type)
        {
            TypeIcon typeIcon;

            if (type.IsValueType)
            {
                if (type.IsEnum)
                {
                    typeIcon = TypeIcon.Enum;
                }
                else
                {
                    typeIcon = TypeIcon.Struct;
                }
            }
            else
            {
                if (type.IsInterface)
                {
                    typeIcon = TypeIcon.Interface;
                }
                else if (IsDelegate(type))
                {
                    typeIcon = TypeIcon.Delegate;
                }
                else if (IsStaticClass(type))
                {
                    typeIcon = TypeIcon.StaticClass;
                }
                else
                {
                    typeIcon = TypeIcon.Class;
                }
            }

            AccessOverlayIcon overlayIcon = GetOverlayIcon(type);

            return(Images.GetIcon(typeIcon, overlayIcon));
        }
Пример #13
0
            private static ImageSource GetOverlayImage(AccessOverlayIcon overlay)
            {
                ImageSource overlayImage;

                switch (overlay)
                {
                case AccessOverlayIcon.Public:
                    overlayImage = null;
                    break;

                case AccessOverlayIcon.Protected:
                    overlayImage = Images.OverlayProtected;
                    break;

                case AccessOverlayIcon.Internal:
                    overlayImage = Images.OverlayInternal;
                    break;

                case AccessOverlayIcon.ProtectedInternal:
                    overlayImage = Images.OverlayProtectedInternal;
                    break;

                case AccessOverlayIcon.Private:
                    overlayImage = Images.OverlayPrivate;
                    break;

                case AccessOverlayIcon.PrivateProtected:
                    overlayImage = Images.OverlayPrivateProtected;
                    break;

                case AccessOverlayIcon.CompilerControlled:
                    overlayImage = Images.OverlayCompilerControlled;
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(overlay), $"AccessOverlayIcon.{overlay} is not supported!");
                }
                return(overlayImage);
            }
Пример #14
0
 public static ImageSource GetIcon(TypeIcon icon, AccessOverlayIcon overlay, bool isStatic = false)
 {
     lock (typeIconCache)
         return(typeIconCache.GetIcon(icon, overlay, isStatic));
 }
Пример #15
0
 public static IBitmap GetIcon(MemberIcon icon, AccessOverlayIcon overlay, bool isStatic)
 {
     lock (memberIconCache)
         return(memberIconCache.GetIcon(icon, overlay, isStatic));
 }