private bool IsCurrentNamespaceAllowed(NamespaceMatchMode matchMode) { string[] currentNamespaceParts = namespaceNames.Reverse().ToArray(); if (IsCurrentNamespacePartOfJetBrainsAnnotations(currentNamespaceParts)) { return(true); } bool?isMatchOnParts = IsMatchOnNamespaceParts(currentNamespaceParts, matchMode); return(isMatchOnParts == null || isMatchOnParts.Value); }
private bool?IsMatchOnNamespaceParts([NotNull][ItemNotNull] string[] currentNamespaceParts, NamespaceMatchMode matchMode) { if (matchMode == NamespaceMatchMode.RequireCompleteMatchWithAssemblyName && assemblyNameParts.Length > currentNamespaceParts.Length) { return(false); } int commonLength = Math.Min(currentNamespaceParts.Length, assemblyNameParts.Length); for (int index = 0; index < commonLength; index++) { if (currentNamespaceParts[index] != assemblyNameParts[index]) { return(false); } } return(null); }