Esempio n. 1
0
        public static bool GetConfigurationValue(this AnalyzerOptions options, ISymbol symbol, string key, bool defaultValue)
        {
            foreach (var location in symbol.Locations)
            {
                var filePath = location.SourceTree?.FilePath;
                if (filePath != null && options.TryGetConfigurationValue(filePath, key, out var str))
                {
                    return(ChangeType(str, defaultValue));
                }
            }

            return(defaultValue);
        }
Esempio n. 2
0
    public static string GetConfigurationValue(this AnalyzerOptions options, ISymbol symbol, string key, string defaultValue)
    {
        foreach (var location in symbol.Locations)
        {
            var syntaxTree = location.SourceTree;
            if (syntaxTree != null && options.TryGetConfigurationValue(syntaxTree, key, out var str))
            {
                return(str);
            }
        }

        return(defaultValue);
    }