public int GetMembersCount(ClassMembersGroups classMembersGroupType) { if (!membersGroups.ContainsKey(classMembersGroupType)) { return 0; } return membersGroups[classMembersGroupType].Count; }
private Dictionary<string, string> GetGenericNamesMappingsForGroup(ClassMembersGroups classMembersGroupType) { if (genericNamesMappings == null) { genericNamesMappings = new Dictionary<ClassMembersGroups, Dictionary<string, string>>(); } Dictionary<string, string> genericNamesMappingsForGroup; if (!genericNamesMappings.ContainsKey(classMembersGroupType)) { genericNamesMappingsForGroup = new Dictionary<string, string>(); genericNamesMappings[classMembersGroupType] = genericNamesMappingsForGroup; } else { genericNamesMappingsForGroup = genericNamesMappings[classMembersGroupType]; } return genericNamesMappingsForGroup; }
public MetaClass GetMember(ClassMembersGroups classMembersGroupType, string name) { if (GetMembersCount(classMembersGroupType) == 0) { return null; } Dictionary<string, MetaClass> membersGroup = membersGroups[classMembersGroupType]; if (!membersGroup.ContainsKey(name)) { // try indirect search (for generic types) if (genericNamesMappings == null || !genericNamesMappings.ContainsKey(classMembersGroupType)) { return null; } Dictionary<string, string> genericNamesMappingForGroup = genericNamesMappings[classMembersGroupType]; if (!genericNamesMappingForGroup.ContainsKey(name)) { return null; } name = genericNamesMappingForGroup[name]; if (!membersGroup.ContainsKey(name)) { return null; } } return membersGroup[name]; }
public bool HasPrivateGroupOfTheSameType(ClassMembersGroups classMembersGroupType) { switch (classMembersGroupType) { case ClassMembersGroups.PublicClasses: { return GetMembersCount(ClassMembersGroups.PrivateClasses) > 0; } case ClassMembersGroups.PublicInterfaces: { return GetMembersCount(ClassMembersGroups.PrivateInterfaces) > 0; } case ClassMembersGroups.PublicStructures: { return GetMembersCount(ClassMembersGroups.PrivateStructures) > 0; } case ClassMembersGroups.PublicDelegates: { return GetMembersCount(ClassMembersGroups.PrivateDelegates) > 0; } case ClassMembersGroups.PublicEnumerations: { return GetMembersCount(ClassMembersGroups.PrivateEnumerations) > 0; } case ClassMembersGroups.PublicFields: { return GetMembersCount(ClassMembersGroups.PrivateFields) > 0; } case ClassMembersGroups.PublicConstructors: { return GetMembersCount(ClassMembersGroups.PrivateConstructors) > 0; } case ClassMembersGroups.PublicMethodsOverloads: { return GetMembersCount(ClassMembersGroups.PrivateMethodsOverloads) > 0; } case ClassMembersGroups.PublicPropertiesOverloads: { return GetMembersCount(ClassMembersGroups.PrivatePropertiesOverloads) > 0; } case ClassMembersGroups.PublicEvents: { return GetMembersCount(ClassMembersGroups.PrivateEvents) > 0; } default: return false; } }
private Dictionary<string, MetaClass> CreateAndGetMembersGroup(ClassMembersGroups classMembersGroupType) { Dictionary<string, MetaClass> membersGroup; if (!membersGroups.ContainsKey(classMembersGroupType)) { membersGroup = new Dictionary<string, MetaClass>(); membersGroups[classMembersGroupType] = membersGroup; } else { membersGroup = membersGroups[classMembersGroupType]; } return membersGroup; }
private void WriteMembersIndex(StreamWriter sw, string sectionHeader, int sectionIndex, IEnumerator<ISummarisableMember> members, string[] columnsNames, int[] columnsWidthsPercentages, NamespaceMembersGroups namespaceMembersGroupsType, ClassMembersGroups classMembersGroupsType, bool dontResolveLinks) { WriteIndexSectionBegin(sw, sectionHeader, sectionIndex); WriteIndexMembersTableBegin(sw, columnsNames, columnsWidthsPercentages); while (members.MoveNext()) { ISummarisableMember member = members.Current; string summary = member.Summary; string memberName = Utils.HTMLEncode(member.DisplayableName); string link = null; if (!dontResolveLinks) { link = ResolveLink((MetaClass)member); } IconsTypes iconsTypes = GetIconsTypes(member, namespaceMembersGroupsType, classMembersGroupsType); WriteIndexMembersTableRow(sw, memberName, link, summary, Icons.GetFileNames(iconsTypes), Icons.GetAltLabels(iconsTypes)); } WriteIndexMembersTableEnd(sw); WriteIndexSectionEnd(sw); }
public MyInvokableMemberInfo FindMethodOrConstructor(string xmlMemberId, bool global) { string memberName; string paramsStr; string returnTypeFullName; MyClassInfo memberDeclaringType = ExtractTypeMemberInfo(xmlMemberId, global, out memberName, out paramsStr, out returnTypeFullName); if (memberDeclaringType == null) { return null; } bool isConstructor = false; if (memberName == "#ctor") { isConstructor = true; memberName = memberDeclaringType.Name; } ClassMembersGroups[] constructorMembersGroups = new ClassMembersGroups[] { ClassMembersGroups.PublicConstructors, ClassMembersGroups.ProtectedConstructors, ClassMembersGroups.InternalConstructors, ClassMembersGroups.ProtectedInternalConstructors, ClassMembersGroups.PrivateConstructors }; ClassMembersGroups[] methodMembersGroups = new ClassMembersGroups[] { ClassMembersGroups.PublicMethodsOverloads, ClassMembersGroups.ProtectedMethodsOverloads, ClassMembersGroups.InternalMethodsOverloads, ClassMembersGroups.ProtectedInternalMethodsOverloads, ClassMembersGroups.PrivateMethodsOverloads }; Debug.Assert(constructorMembersGroups.Length == methodMembersGroups.Length); for (int i = 0; i < constructorMembersGroups.Length; i++) { ClassMembersGroups classMembersGroup; if (isConstructor) { classMembersGroup = constructorMembersGroups[i]; } else { classMembersGroup = methodMembersGroups[i]; if (MyMethodInfo.MethodsNamesMappings.ContainsKey(memberName)) { memberName = MyMethodInfo.MethodsNamesMappings[memberName]; } } MyInvokableMembersOverloadsInfo invokableMembers = memberDeclaringType.GetMember(classMembersGroup, memberName) as MyInvokableMembersOverloadsInfo; if (invokableMembers == null) { continue; } List<string> paramsTypes = SplitXmlParamsString(paramsStr); foreach (MyInvokableMemberInfo myInvokableMember in invokableMembers) { List<MyGenericParameterInfo> memberGenericParameters = null; if (!isConstructor) { MyMethodInfo myMethodInfo = (MyMethodInfo)myInvokableMember; if (myMethodInfo.GenericParametersCount > 0) { memberGenericParameters = myMethodInfo.GenericParameters; } } if (SignaturesMatch(myInvokableMember.ParametersNames, myInvokableMember.Parameters, paramsTypes, memberDeclaringType, memberGenericParameters) && (isConstructor || returnTypeFullName == null || ReturnTypesMatch(((MyMethodInfo)myInvokableMember).ReturnTypeFullNameWithoutRevArrayStrings, returnTypeFullName, memberDeclaringType, memberGenericParameters))) { return myInvokableMember; } } } return null; }
public static string ClassMembersGroupsToString(ClassMembersGroups classMembersGroupType) { switch (classMembersGroupType) { case ClassMembersGroups.PublicClasses: return "Public Classes"; case ClassMembersGroups.PublicInterfaces: return "Public Interfaces"; case ClassMembersGroups.PublicStructures: return "Public Structures"; case ClassMembersGroups.PublicDelegates: return "Public Delegates"; case ClassMembersGroups.PublicEnumerations: return "Public Enumerations"; case ClassMembersGroups.PublicConstructors: return "Public Constructors"; case ClassMembersGroups.PublicMethodsOverloads: return "Public Methods"; case ClassMembersGroups.PublicFields: return "Public Fields"; case ClassMembersGroups.PublicEvents: return "Public Events"; case ClassMembersGroups.PublicPropertiesOverloads: return "Public Properties"; case ClassMembersGroups.ProtectedClasses: return "Protected Classes"; case ClassMembersGroups.ProtectedInterfaces: return "Protected Interfaces"; case ClassMembersGroups.ProtectedStructures: return "Protected Structures"; case ClassMembersGroups.ProtectedDelegates: return "Protected Delegates"; case ClassMembersGroups.ProtectedEnumerations: return "Protected Enumerations"; case ClassMembersGroups.ProtectedConstructors: return "Protected Constructors"; case ClassMembersGroups.ProtectedMethodsOverloads: return "Protected Methods"; case ClassMembersGroups.ProtectedFields: return "Protected Fields"; case ClassMembersGroups.ProtectedEvents: return "Protected Events"; case ClassMembersGroups.ProtectedPropertiesOverloads: return "Protected Properties"; case ClassMembersGroups.InternalClasses: return "Internal Classes"; case ClassMembersGroups.InternalInterfaces: return "Internal Interfaces"; case ClassMembersGroups.InternalStructures: return "Internal Structures"; case ClassMembersGroups.InternalDelegates: return "Internal Delegates"; case ClassMembersGroups.InternalEnumerations: return "Internal Enumerations"; case ClassMembersGroups.InternalConstructors: return "Internal Constructors"; case ClassMembersGroups.InternalMethodsOverloads: return "Internal Methods"; case ClassMembersGroups.InternalFields: return "Internal Fields"; case ClassMembersGroups.InternalEvents: return "Internal Events"; case ClassMembersGroups.InternalPropertiesOverloads: return "Internal Properties"; case ClassMembersGroups.ProtectedInternalClasses: return "Protected Internal Classes"; case ClassMembersGroups.ProtectedInternalInterfaces: return "Protected Internal Interfaces"; case ClassMembersGroups.ProtectedInternalStructures: return "Protected Internal Structures"; case ClassMembersGroups.ProtectedInternalDelegates: return "Protected Internal Delegates"; case ClassMembersGroups.ProtectedInternalEnumerations: return "Protected Internal Enumerations"; case ClassMembersGroups.ProtectedInternalConstructors: return "Protected Internal Constructors"; case ClassMembersGroups.ProtectedInternalMethodsOverloads: return "Protected Internal Methods"; case ClassMembersGroups.ProtectedInternalFields: return "Protected Internal Fields"; case ClassMembersGroups.ProtectedInternalEvents: return "Protected Internal Events"; case ClassMembersGroups.ProtectedInternalPropertiesOverloads: return "Protected Internal Properties"; case ClassMembersGroups.PrivateClasses: return "Private Classes"; case ClassMembersGroups.PrivateInterfaces: return "Private Interfaces"; case ClassMembersGroups.PrivateStructures: return "Private Structures"; case ClassMembersGroups.PrivateDelegates: return "Private Delegates"; case ClassMembersGroups.PrivateEnumerations: return "Private Enumerations"; case ClassMembersGroups.PrivateConstructors: return "Private Constructors"; case ClassMembersGroups.PrivateMethodsOverloads: return "Private Methods"; case ClassMembersGroups.PrivateFields: return "Private Fields"; case ClassMembersGroups.PrivateEvents: return "Private Events"; case ClassMembersGroups.PrivatePropertiesOverloads: return "Private Properties"; default: return classMembersGroupType.ToString(); } }
public static string GetBaseGroupName(ClassMembersGroups classMembersGroupType) { switch (classMembersGroupType) { case ClassMembersGroups.PublicClasses: { return "Classes"; } case ClassMembersGroups.PublicInterfaces: { return "Interfaces"; } case ClassMembersGroups.PublicStructures: { return "Structures"; } case ClassMembersGroups.PublicDelegates: { return "Delegates"; } case ClassMembersGroups.PublicEnumerations: { return "Enumerations"; } case ClassMembersGroups.PublicFields: { return "Fields"; } case ClassMembersGroups.PublicConstructors: { return "Constructors"; } case ClassMembersGroups.PublicMethodsOverloads: { return "Methods"; } case ClassMembersGroups.PublicPropertiesOverloads: { return "Properties"; } case ClassMembersGroups.PublicEvents: { return "Events"; } case ClassMembersGroups.ProtectedClasses: { return "Classes"; } case ClassMembersGroups.ProtectedInterfaces: { return "Interfaces"; } case ClassMembersGroups.ProtectedStructures: { return "Structures"; } case ClassMembersGroups.ProtectedDelegates: { return "Delegates"; } case ClassMembersGroups.ProtectedEnumerations: { return "Enumerations"; } case ClassMembersGroups.ProtectedFields: { return "Fields"; } case ClassMembersGroups.ProtectedConstructors: { return "Constructors"; } case ClassMembersGroups.ProtectedMethodsOverloads: { return "Methods"; } case ClassMembersGroups.ProtectedPropertiesOverloads: { return "Properties"; } case ClassMembersGroups.ProtectedEvents: { return "Events"; } case ClassMembersGroups.InternalClasses: { return "Classes"; } case ClassMembersGroups.InternalInterfaces: { return "Interfaces"; } case ClassMembersGroups.InternalStructures: { return "Structures"; } case ClassMembersGroups.InternalDelegates: { return "Delegates"; } case ClassMembersGroups.InternalEnumerations: { return "Enumerations"; } case ClassMembersGroups.InternalFields: { return "Fields"; } case ClassMembersGroups.InternalConstructors: { return "Constructors"; } case ClassMembersGroups.InternalMethodsOverloads: { return "Methods"; } case ClassMembersGroups.InternalPropertiesOverloads: { return "Properties"; } case ClassMembersGroups.InternalEvents: { return "Events"; } case ClassMembersGroups.ProtectedInternalClasses: { return "Classes"; } case ClassMembersGroups.ProtectedInternalInterfaces: { return "Interfaces"; } case ClassMembersGroups.ProtectedInternalStructures: { return "Structures"; } case ClassMembersGroups.ProtectedInternalDelegates: { return "Delegates"; } case ClassMembersGroups.ProtectedInternalEnumerations: { return "Enumerations"; } case ClassMembersGroups.ProtectedInternalFields: { return "Fields"; } case ClassMembersGroups.ProtectedInternalConstructors: { return "Constructors"; } case ClassMembersGroups.ProtectedInternalMethodsOverloads: { return "Methods"; } case ClassMembersGroups.ProtectedInternalPropertiesOverloads: { return "Properties"; } case ClassMembersGroups.ProtectedInternalEvents: { return "Events"; } case ClassMembersGroups.PrivateClasses: { return "Classes"; } case ClassMembersGroups.PrivateInterfaces: { return "Interfaces"; } case ClassMembersGroups.PrivateStructures: { return "Structures"; } case ClassMembersGroups.PrivateDelegates: { return "Delegates"; } case ClassMembersGroups.PrivateEnumerations: { return "Enumerations"; } case ClassMembersGroups.PrivateFields: { return "Fields"; } case ClassMembersGroups.PrivateConstructors: { return "Constructors"; } case ClassMembersGroups.PrivateMethodsOverloads: { return "Methods"; } case ClassMembersGroups.PrivatePropertiesOverloads: { return "Properties"; } case ClassMembersGroups.PrivateEvents: { return "Events"; } default: { Debug.Assert(false, "Impossible! Couldn't recognize type of a class member."); return null; } } }
private void AddGenericNameMappingIfNeeded(MetaClass metaClass, ClassMembersGroups classMembersGroupType) { if (!metaClass.Name.Contains("<")) { return; } Dictionary<string, string> genericNamesMappingsForGroup = GetGenericNamesMappingsForGroup(classMembersGroupType); string xmlName = Utils.ConvertNameToXmlDocForm(metaClass.Name, true); genericNamesMappingsForGroup[xmlName] = metaClass.Name; }
protected Dictionary<string, MetaClass> GetMembersGroup(ClassMembersGroups classMembersGroupType) { if (!membersGroups.ContainsKey(classMembersGroupType)) { return null; } return membersGroups[classMembersGroupType]; }
public IEnumerator<ISummarisableMember> GetEnumerator(ClassMembersGroups classMembersGroupType) { if (!membersGroups.ContainsKey(classMembersGroupType)) { Debug.Assert(false, "Impossible! Requested for members of an empty group ('" + classMembersGroupType + "')."); yield break; } Dictionary<string, MetaClass> membersGroup = membersGroups[classMembersGroupType]; List<string> sortedKeys = new List<string>(); sortedKeys.AddRange(membersGroup.Keys); sortedKeys.Sort(); foreach (string key in sortedKeys) { yield return (ISummarisableMember)membersGroup[key]; } }
public List<MetaClass> GetMembers(ClassMembersGroups classMembersGroupType) { List<MetaClass> result = new List<MetaClass>(); Dictionary<string, MetaClass> membersGroup = GetMembersGroup(classMembersGroupType); if (membersGroup == null) { return result; } result.AddRange(membersGroup.Values); return result; }
public static IconsTypes GetIconType(ClassMembersGroups classMembersGroupType) { switch (classMembersGroupType) { case ClassMembersGroups.PublicClasses: return IconsTypes.PublicClass; case ClassMembersGroups.PublicConstructors: return IconsTypes.PublicMethod; case ClassMembersGroups.PublicDelegates: return IconsTypes.PublicDelegate; case ClassMembersGroups.PublicEnumerations: return IconsTypes.PublicEnumeration; case ClassMembersGroups.PublicEvents: return IconsTypes.PublicEvent; case ClassMembersGroups.PublicFields: return IconsTypes.PublicField; case ClassMembersGroups.PublicInterfaces: return IconsTypes.PublicInterface; case ClassMembersGroups.PublicMethodsOverloads: return IconsTypes.PublicMethod; case ClassMembersGroups.PublicPropertiesOverloads: return IconsTypes.PublicProperty; case ClassMembersGroups.PublicStructures: return IconsTypes.PublicStructure; case ClassMembersGroups.ProtectedClasses: return IconsTypes.ProtectedClass; case ClassMembersGroups.ProtectedConstructors: return IconsTypes.ProtectedMethod; case ClassMembersGroups.ProtectedDelegates: return IconsTypes.ProtectedDelegate; case ClassMembersGroups.ProtectedEnumerations: return IconsTypes.ProtectedEnumeration; case ClassMembersGroups.ProtectedEvents: return IconsTypes.ProtectedEvent; case ClassMembersGroups.ProtectedFields: return IconsTypes.ProtectedField; case ClassMembersGroups.ProtectedInterfaces: return IconsTypes.ProtectedInterface; case ClassMembersGroups.ProtectedMethodsOverloads: return IconsTypes.ProtectedMethod; case ClassMembersGroups.ProtectedPropertiesOverloads: return IconsTypes.ProtectedProperty; case ClassMembersGroups.ProtectedStructures: return IconsTypes.ProtectedStructure; case ClassMembersGroups.InternalClasses: return IconsTypes.InternalClass; case ClassMembersGroups.InternalConstructors: return IconsTypes.InternalMethod; case ClassMembersGroups.InternalDelegates: return IconsTypes.InternalDelegate; case ClassMembersGroups.InternalEnumerations: return IconsTypes.InternalEnumeration; case ClassMembersGroups.InternalEvents: return IconsTypes.InternalEvent; case ClassMembersGroups.InternalFields: return IconsTypes.InternalField; case ClassMembersGroups.InternalInterfaces: return IconsTypes.InternalInterface; case ClassMembersGroups.InternalMethodsOverloads: return IconsTypes.InternalMethod; case ClassMembersGroups.InternalPropertiesOverloads: return IconsTypes.InternalProperty; case ClassMembersGroups.InternalStructures: return IconsTypes.InternalStructure; case ClassMembersGroups.ProtectedInternalClasses: return IconsTypes.ProtectedInternalClass; case ClassMembersGroups.ProtectedInternalConstructors: return IconsTypes.ProtectedInternalMethod; case ClassMembersGroups.ProtectedInternalDelegates: return IconsTypes.ProtectedInternalDelegate; case ClassMembersGroups.ProtectedInternalEnumerations: return IconsTypes.ProtectedInternalEnumeration; case ClassMembersGroups.ProtectedInternalEvents: return IconsTypes.ProtectedInternalEvent; case ClassMembersGroups.ProtectedInternalFields: return IconsTypes.ProtectedInternalField; case ClassMembersGroups.ProtectedInternalInterfaces: return IconsTypes.ProtectedInternalInterface; case ClassMembersGroups.ProtectedInternalMethodsOverloads: return IconsTypes.ProtectedInternalMethod; case ClassMembersGroups.ProtectedInternalPropertiesOverloads: return IconsTypes.ProtectedInternalProperty; case ClassMembersGroups.ProtectedInternalStructures: return IconsTypes.ProtectedInternalStructure; case ClassMembersGroups.PrivateClasses: return IconsTypes.PrivateClass; case ClassMembersGroups.PrivateConstructors: return IconsTypes.PrivateMethod; case ClassMembersGroups.PrivateDelegates: return IconsTypes.PrivateDelegate; case ClassMembersGroups.PrivateEnumerations: return IconsTypes.PrivateEnumeration; case ClassMembersGroups.PrivateEvents: return IconsTypes.PrivateEvent; case ClassMembersGroups.PrivateFields: return IconsTypes.PrivateField; case ClassMembersGroups.PrivateInterfaces: return IconsTypes.PrivateInterface; case ClassMembersGroups.PrivateMethodsOverloads: return IconsTypes.PrivateMethod; case ClassMembersGroups.PrivatePropertiesOverloads: return IconsTypes.PrivateProperty; case ClassMembersGroups.PrivateStructures: return IconsTypes.PrivateStructure; default: { Debug.Assert(false, "Impossible! Couldn't return correct type of icon."); return (IconsTypes)0; } } }
public MyInvokableMemberInfo FindMethodOrConstructor(string xmlMemberId, bool global) { string memberName; string paramsStr; string returnTypeFullName; MyClassInfo memberDeclaringType = ExtractTypeMemberInfo(xmlMemberId, global, out memberName, out paramsStr, out returnTypeFullName); if (memberDeclaringType == null) { return(null); } bool isConstructor = false; if (memberName == "#ctor") { isConstructor = true; memberName = memberDeclaringType.Name; } ClassMembersGroups[] constructorMembersGroups = new ClassMembersGroups[] { ClassMembersGroups.PublicConstructors, ClassMembersGroups.ProtectedConstructors, ClassMembersGroups.InternalConstructors, ClassMembersGroups.ProtectedInternalConstructors, ClassMembersGroups.PrivateConstructors }; ClassMembersGroups[] methodMembersGroups = new ClassMembersGroups[] { ClassMembersGroups.PublicMethodsOverloads, ClassMembersGroups.ProtectedMethodsOverloads, ClassMembersGroups.InternalMethodsOverloads, ClassMembersGroups.ProtectedInternalMethodsOverloads, ClassMembersGroups.PrivateMethodsOverloads }; Debug.Assert(constructorMembersGroups.Length == methodMembersGroups.Length); for (int i = 0; i < constructorMembersGroups.Length; i++) { ClassMembersGroups classMembersGroup; if (isConstructor) { classMembersGroup = constructorMembersGroups[i]; } else { classMembersGroup = methodMembersGroups[i]; if (MyMethodInfo.MethodsNamesMappings.ContainsKey(memberName)) { memberName = MyMethodInfo.MethodsNamesMappings[memberName]; } } MyInvokableMembersOverloadsInfo invokableMembers = memberDeclaringType.GetMember(classMembersGroup, memberName) as MyInvokableMembersOverloadsInfo; if (invokableMembers == null) { continue; } List <string> paramsTypes = SplitXmlParamsString(paramsStr); foreach (MyInvokableMemberInfo myInvokableMember in invokableMembers) { List <MyGenericParameterInfo> memberGenericParameters = null; if (!isConstructor) { MyMethodInfo myMethodInfo = (MyMethodInfo)myInvokableMember; if (myMethodInfo.GenericParametersCount > 0) { memberGenericParameters = myMethodInfo.GenericParameters; } } if (SignaturesMatch(myInvokableMember.ParametersNames, myInvokableMember.Parameters, paramsTypes, memberDeclaringType, memberGenericParameters) && (isConstructor || returnTypeFullName == null || ReturnTypesMatch(((MyMethodInfo)myInvokableMember).ReturnTypeFullNameWithoutRevArrayStrings, returnTypeFullName, memberDeclaringType, memberGenericParameters))) { return(myInvokableMember); } } } return(null); }
public static bool IsMembersGroupPublic(ClassMembersGroups classMembersGroupType) { switch (classMembersGroupType) { case ClassMembersGroups.PublicClasses: { return true; } case ClassMembersGroups.PublicInterfaces: { return true; } case ClassMembersGroups.PublicStructures: { return true; } case ClassMembersGroups.PublicDelegates: { return true; } case ClassMembersGroups.PublicEnumerations: { return true; } case ClassMembersGroups.PublicFields: { return true; } case ClassMembersGroups.PublicConstructors: { return true; } case ClassMembersGroups.PublicMethodsOverloads: { return true; } case ClassMembersGroups.PublicPropertiesOverloads: { return true; } case ClassMembersGroups.PublicEvents: { return true; } default: return false; } }
private void WriteMembersIndex(StreamWriter sw, string sectionHeader, int sectionIndex, IEnumerator<ISummarisableMember> members, string[] columnsNames, int[] columnsWidthsPercentages, NamespaceMembersGroups namespaceMembersGroupsType, ClassMembersGroups classMembersGroupsType) { WriteMembersIndex(sw, sectionHeader, sectionIndex, members, columnsNames, columnsWidthsPercentages, namespaceMembersGroupsType, classMembersGroupsType, false); }
public bool HasInternalGroupOfTheSameType(ClassMembersGroups classMembersGroupType) { switch (classMembersGroupType) { case ClassMembersGroups.PublicClasses: { return GetMembersCount(ClassMembersGroups.InternalClasses) > 0; } case ClassMembersGroups.PublicInterfaces: { return GetMembersCount(ClassMembersGroups.InternalInterfaces) > 0; } case ClassMembersGroups.PublicStructures: { return GetMembersCount(ClassMembersGroups.InternalStructures) > 0; } case ClassMembersGroups.PublicDelegates: { return GetMembersCount(ClassMembersGroups.InternalDelegates) > 0; } case ClassMembersGroups.PublicEnumerations: { return GetMembersCount(ClassMembersGroups.InternalEnumerations) > 0; } case ClassMembersGroups.PublicFields: { return GetMembersCount(ClassMembersGroups.InternalFields) > 0; } case ClassMembersGroups.PublicConstructors: { return GetMembersCount(ClassMembersGroups.InternalConstructors) > 0; } case ClassMembersGroups.PublicMethodsOverloads: { return GetMembersCount(ClassMembersGroups.InternalMethodsOverloads) > 0; } case ClassMembersGroups.PublicPropertiesOverloads: { return GetMembersCount(ClassMembersGroups.InternalPropertiesOverloads) > 0; } case ClassMembersGroups.PublicEvents: { return GetMembersCount(ClassMembersGroups.InternalEvents) > 0; } default: return false; } }
private IconsTypes GetIconsTypes(ISummarisableMember member, NamespaceMembersGroups namespaceMembersGroupType, ClassMembersGroups classMembersGroupType) { if (member is MyAssemblyInfo) { return IconsTypes.Assembly; } else if (member is MyNamespaceInfo) { return IconsTypes.Namespace; } else if (member is MyClassInfo) { MyClassInfo myClassInfo = (MyClassInfo)member; IconsTypes iconsTypes = Icons.GetIconType(namespaceMembersGroupType); if (myClassInfo.IsAbstract && !myClassInfo.IsSealed) { iconsTypes |= IconsTypes.Abstract; } if (myClassInfo.IsStatic) { iconsTypes |= IconsTypes.Static; } if (myClassInfo is MyInterfaceInfo) { iconsTypes &= ~IconsTypes.Abstract; } return iconsTypes; } else if (member is MyInvokableMembersOverloadsInfo) { MyInvokableMembersOverloadsInfo myInvokableMembersOverloadsInfo = (MyInvokableMembersOverloadsInfo)member; MyInvokableMemberInfo myInvokableMemberInfo = null; foreach (MyInvokableMemberInfo tmpMyInvokableMemberInfo in myInvokableMembersOverloadsInfo) { myInvokableMemberInfo = tmpMyInvokableMemberInfo; break; } if (myInvokableMemberInfo == null) { Debug.Assert(false, "Impossible! There should be at least one overload."); } return GetIconsTypes(myInvokableMemberInfo, namespaceMembersGroupType, classMembersGroupType); } else if (member is MyPropertiesOverloadsInfo) { MyPropertiesOverloadsInfo myPropertiesOverloadsInfo = (MyPropertiesOverloadsInfo)member; MyPropertyInfo myPropertyInfo = null; foreach (MyPropertyInfo tmpMyPropertyInfo in myPropertiesOverloadsInfo) { myPropertyInfo = tmpMyPropertyInfo; break; } if (myPropertyInfo == null) { Debug.Assert(false, "Impossible! There should be at least one overload."); } return GetIconsTypes(myPropertyInfo, namespaceMembersGroupType, classMembersGroupType); } else if (member is MyInvokableMemberInfo) { MyInvokableMemberInfo myInvokableMemberInfo = (MyInvokableMemberInfo)member; IconsTypes iconsTypes = IconsTypes.None; if (myInvokableMemberInfo.IsPublic) { iconsTypes = IconsTypes.PublicMethod; } else if (myInvokableMemberInfo.IsProtectedInternal) { iconsTypes = IconsTypes.ProtectedInternalMethod; } else if (myInvokableMemberInfo.IsProtected) { iconsTypes = IconsTypes.ProtectedMethod; } else if (myInvokableMemberInfo.IsInternal) { iconsTypes = IconsTypes.InternalMethod; } else if (myInvokableMemberInfo.IsPrivate) { iconsTypes = IconsTypes.PrivateMethod; } if (myInvokableMemberInfo.IsStatic) { iconsTypes |= IconsTypes.Static; } if (myInvokableMemberInfo.IsAbstract) { iconsTypes |= IconsTypes.Abstract; } if (myInvokableMemberInfo.IsVirtual && !myInvokableMemberInfo.IsAbstract) { iconsTypes |= IconsTypes.Virtual; } if (myInvokableMemberInfo.IsOverride && !myInvokableMemberInfo.IsSealed) { iconsTypes |= IconsTypes.Virtual; } return iconsTypes; } else if (member is MyFieldInfo) { if (namespaceMembersGroupType == NamespaceMembersGroups.PublicEnumerations || namespaceMembersGroupType == NamespaceMembersGroups.ProtectedInternalEnumerations || namespaceMembersGroupType == NamespaceMembersGroups.ProtectedEnumerations || namespaceMembersGroupType == NamespaceMembersGroups.InternalEnumerations || namespaceMembersGroupType == NamespaceMembersGroups.PrivateEnumerations) { IconsTypes iconsTypes = IconsTypes.EnumField; return iconsTypes; } else { MyFieldInfo myFieldInfo = (MyFieldInfo)member; IconsTypes iconsTypes = Icons.GetIconType(classMembersGroupType); if (myFieldInfo.IsStatic) { iconsTypes |= IconsTypes.Static; } if (myFieldInfo.IsConst) { iconsTypes |= IconsTypes.Static; } return iconsTypes; } } else if (member is MyPropertyInfo) { MyPropertyInfo myPropertyInfo = (MyPropertyInfo)member; IconsTypes iconsTypes = Icons.GetIconType(classMembersGroupType); if (myPropertyInfo.IsStatic) { iconsTypes |= IconsTypes.Static; } if (myPropertyInfo.IsAbstract) { iconsTypes |= IconsTypes.Abstract; } if (myPropertyInfo.IsVirtual && !myPropertyInfo.IsAbstract) { iconsTypes |= IconsTypes.Virtual; } return iconsTypes; } else if (member is MyEventInfo) { MyEventInfo myEventInfo = (MyEventInfo)member; IconsTypes iconsTypes = Icons.GetIconType(classMembersGroupType); if (myEventInfo.IsStatic) { iconsTypes |= IconsTypes.Static; } if (myEventInfo.IsAbstract) { iconsTypes |= IconsTypes.Abstract; } if (myEventInfo.IsVirtual && !myEventInfo.IsAbstract) { iconsTypes |= IconsTypes.Virtual; } return iconsTypes; } else if (member is MyNestedTypeInfo) { MyNestedTypeInfo myNestedTypeInfo = (MyNestedTypeInfo)member; IconsTypes iconsTypes = Icons.GetIconType(classMembersGroupType); if (myNestedTypeInfo.IsAbstract && !myNestedTypeInfo.IsSealed) { iconsTypes |= IconsTypes.Abstract; } if (myNestedTypeInfo.IsStatic) { iconsTypes |= IconsTypes.Static; } if (myNestedTypeInfo.MetaType == NestedTypes.Interface) { iconsTypes &= ~IconsTypes.Abstract; } return iconsTypes; } else { Debug.Assert(false, "Impossible! Can't find icon for type " + member.GetType() + "."); } return IconsTypes.None; }
public static IconsTypes GetIconType(ClassMembersGroups classMembersGroupType) { switch (classMembersGroupType) { case ClassMembersGroups.PublicClasses: return(IconsTypes.PublicClass); case ClassMembersGroups.PublicConstructors: return(IconsTypes.PublicMethod); case ClassMembersGroups.PublicDelegates: return(IconsTypes.PublicDelegate); case ClassMembersGroups.PublicEnumerations: return(IconsTypes.PublicEnumeration); case ClassMembersGroups.PublicEvents: return(IconsTypes.PublicEvent); case ClassMembersGroups.PublicFields: return(IconsTypes.PublicField); case ClassMembersGroups.PublicInterfaces: return(IconsTypes.PublicInterface); case ClassMembersGroups.PublicMethodsOverloads: return(IconsTypes.PublicMethod); case ClassMembersGroups.PublicPropertiesOverloads: return(IconsTypes.PublicProperty); case ClassMembersGroups.PublicStructures: return(IconsTypes.PublicStructure); case ClassMembersGroups.ProtectedClasses: return(IconsTypes.ProtectedClass); case ClassMembersGroups.ProtectedConstructors: return(IconsTypes.ProtectedMethod); case ClassMembersGroups.ProtectedDelegates: return(IconsTypes.ProtectedDelegate); case ClassMembersGroups.ProtectedEnumerations: return(IconsTypes.ProtectedEnumeration); case ClassMembersGroups.ProtectedEvents: return(IconsTypes.ProtectedEvent); case ClassMembersGroups.ProtectedFields: return(IconsTypes.ProtectedField); case ClassMembersGroups.ProtectedInterfaces: return(IconsTypes.ProtectedInterface); case ClassMembersGroups.ProtectedMethodsOverloads: return(IconsTypes.ProtectedMethod); case ClassMembersGroups.ProtectedPropertiesOverloads: return(IconsTypes.ProtectedProperty); case ClassMembersGroups.ProtectedStructures: return(IconsTypes.ProtectedStructure); case ClassMembersGroups.InternalClasses: return(IconsTypes.InternalClass); case ClassMembersGroups.InternalConstructors: return(IconsTypes.InternalMethod); case ClassMembersGroups.InternalDelegates: return(IconsTypes.InternalDelegate); case ClassMembersGroups.InternalEnumerations: return(IconsTypes.InternalEnumeration); case ClassMembersGroups.InternalEvents: return(IconsTypes.InternalEvent); case ClassMembersGroups.InternalFields: return(IconsTypes.InternalField); case ClassMembersGroups.InternalInterfaces: return(IconsTypes.InternalInterface); case ClassMembersGroups.InternalMethodsOverloads: return(IconsTypes.InternalMethod); case ClassMembersGroups.InternalPropertiesOverloads: return(IconsTypes.InternalProperty); case ClassMembersGroups.InternalStructures: return(IconsTypes.InternalStructure); case ClassMembersGroups.ProtectedInternalClasses: return(IconsTypes.ProtectedInternalClass); case ClassMembersGroups.ProtectedInternalConstructors: return(IconsTypes.ProtectedInternalMethod); case ClassMembersGroups.ProtectedInternalDelegates: return(IconsTypes.ProtectedInternalDelegate); case ClassMembersGroups.ProtectedInternalEnumerations: return(IconsTypes.ProtectedInternalEnumeration); case ClassMembersGroups.ProtectedInternalEvents: return(IconsTypes.ProtectedInternalEvent); case ClassMembersGroups.ProtectedInternalFields: return(IconsTypes.ProtectedInternalField); case ClassMembersGroups.ProtectedInternalInterfaces: return(IconsTypes.ProtectedInternalInterface); case ClassMembersGroups.ProtectedInternalMethodsOverloads: return(IconsTypes.ProtectedInternalMethod); case ClassMembersGroups.ProtectedInternalPropertiesOverloads: return(IconsTypes.ProtectedInternalProperty); case ClassMembersGroups.ProtectedInternalStructures: return(IconsTypes.ProtectedInternalStructure); case ClassMembersGroups.PrivateClasses: return(IconsTypes.PrivateClass); case ClassMembersGroups.PrivateConstructors: return(IconsTypes.PrivateMethod); case ClassMembersGroups.PrivateDelegates: return(IconsTypes.PrivateDelegate); case ClassMembersGroups.PrivateEnumerations: return(IconsTypes.PrivateEnumeration); case ClassMembersGroups.PrivateEvents: return(IconsTypes.PrivateEvent); case ClassMembersGroups.PrivateFields: return(IconsTypes.PrivateField); case ClassMembersGroups.PrivateInterfaces: return(IconsTypes.PrivateInterface); case ClassMembersGroups.PrivateMethodsOverloads: return(IconsTypes.PrivateMethod); case ClassMembersGroups.PrivatePropertiesOverloads: return(IconsTypes.PrivateProperty); case ClassMembersGroups.PrivateStructures: return(IconsTypes.PrivateStructure); default: { Debug.Assert(false, "Impossible! Couldn't return correct type of icon."); return((IconsTypes)0); } } }