예제 #1
0
        internal static ImmutableArray <string>?TryGetStringListValue(AnalyzerConfigOptionsWrapper analyzerConfigOptions, string key, bool allowExplicitUnset = true)
        {
            if (analyzerConfigOptions.TryGetValue(key, out var value))
            {
                if (allowExplicitUnset && value == "unset")
                {
                    return(null);
                }

                return(value.Split(',').Select(static x => x.Trim()).ToImmutableArray());
예제 #2
0
        internal static int?TryGetInt32Value(AnalyzerConfigOptionsWrapper analyzerConfigOptions, string key)
        {
            if (analyzerConfigOptions.TryGetValue(key, out var value) &&
                value != "unset" &&
                int.TryParse(value, out var intValue))
            {
                return(intValue);
            }

            return(null);
        }
예제 #3
0
        internal static bool?TryGetBooleanValue(AnalyzerConfigOptionsWrapper analyzerConfigOptions, string key)
        {
            if (analyzerConfigOptions.TryGetValue(key, out var value) &&
                value != "unset" &&
                bool.TryParse(value, out var boolValue))
            {
                return(boolValue);
            }

            return(null);
        }
예제 #4
0
        internal static string TryGetStringValue(AnalyzerConfigOptionsWrapper analyzerConfigOptions, string key, bool allowExplicitUnset = true)
        {
            if (analyzerConfigOptions.TryGetValue(key, out var value))
            {
                if (allowExplicitUnset && value == "unset")
                {
                    return(null);
                }

                return(value);
            }

            return(null);
        }
예제 #5
0
        internal static KeyValuePair <string, string>?TryGetStringValueAndNotification(AnalyzerConfigOptionsWrapper analyzerConfigOptions, string key, bool allowExplicitUnset = true)
        {
            if (analyzerConfigOptions.TryGetValue(key, out var value))
            {
                if (allowExplicitUnset && value == "unset")
                {
                    return(null);
                }

                var colonIndex = value.IndexOf(':');
                if (colonIndex >= 0)
                {
                    return(new KeyValuePair <string, string>(value.Substring(0, colonIndex), value.Substring(colonIndex + 1)));
                }
            }

            return(null);
        }