/// <summary>
        /// Tries to determine the resource set which is referenced by the
        /// resource manager which is assigned to the specified member.
        /// </summary>
        /// <param name="member">The referenced member to examine.</param>
        /// <returns>
        /// The ResourceSetReference, if successful, or a null reference, if the
        /// specified member is not a resource manager or if the
        /// resource file cannot be determined.
        /// </returns>
        static ResourceSetReference ResolveResourceSet(IMember member)
        {
            if (member != null && member.ReturnType != null &&
                member.DeclaringType != null && member.DeclaringType.CompilationUnit != null)
            {
                ResourceSetReference rsr;
                if (!NRefactoryAstCacheService.CacheEnabled || !cachedResourceSetReferenceMappings.TryGetValue(member, out rsr))
                {
                    string declaringFileName = member.DeclaringType.CompilationUnit.FileName;
                    if (declaringFileName != null)
                    {
                        if (IsResourceManager(member.ReturnType, declaringFileName))
                        {
                            SupportedLanguage?language = NRefactoryResourceResolver.GetFileLanguage(declaringFileName);
                            if (language == null)
                            {
                                return(null);
                            }

                            CompilationUnit cu = NRefactoryAstCacheService.GetFullAst(language.Value, declaringFileName, ResourceResolverService.GetParsableFileContent(declaringFileName));
                            if (cu != null)
                            {
                                ResourceManagerInitializationFindVisitor visitor = new ResourceManagerInitializationFindVisitor(member);
                                cu.AcceptVisitor(visitor, null);
                                if (visitor.FoundResourceSet != null)
                                {
                                    rsr = visitor.FoundResourceSet;

                                    if (NRefactoryAstCacheService.CacheEnabled)
                                    {
                                        cachedResourceSetReferenceMappings.Add(member, rsr);
                                    }

                                    return(rsr);
                                }
                            }
                        }
                    }

                    return(null);
                }

                return(rsr);
            }
            return(null);
        }
        /// <summary>
        /// Tries to determine the resource set which is referenced by the
        /// resource manager which is assigned to the specified member.
        /// </summary>
        /// <param name="member">The referenced member to examine.</param>
        /// <returns>
        /// The ResourceSetReference, if successful, or a null reference, if the
        /// specified member is not a resource manager or if the
        /// resource file cannot be determined.
        /// </returns>
        static ResourceSetReference ResolveResourceSet(IMember member)
        {
            if (member != null && member.ReturnType != null &&
                member.DeclaringType != null && member.DeclaringType.CompilationUnit != null) {

                ResourceSetReference rsr;
                if (!NRefactoryAstCacheService.CacheEnabled || !cachedResourceSetReferenceMappings.TryGetValue(member, out rsr)) {

                    string declaringFileName = member.DeclaringType.CompilationUnit.FileName;
                    if (declaringFileName != null) {
                        if (IsResourceManager(member.ReturnType, declaringFileName)) {

                            SupportedLanguage? language = NRefactoryResourceResolver.GetFileLanguage(declaringFileName);
                            if (language == null) {
                                return null;
                            }

                            CompilationUnit cu = NRefactoryAstCacheService.GetFullAst(language.Value, declaringFileName, ResourceResolverService.GetParsableFileContent(declaringFileName));
                            if (cu != null) {

                                ResourceManagerInitializationFindVisitor visitor = new ResourceManagerInitializationFindVisitor(member);
                                cu.AcceptVisitor(visitor, null);
                                if (visitor.FoundResourceSet != null) {

                                    rsr = visitor.FoundResourceSet;

                                    if (NRefactoryAstCacheService.CacheEnabled) {
                                        cachedResourceSetReferenceMappings.Add(member, rsr);
                                    }

                                    return rsr;

                                }

                            }

                        }
                    }

                    return null;

                }

                return rsr;

            }
            return null;
        }