Esempio n. 1
0
        private static Optional <CodeStyleOption <ParenthesesPreference> > ParseParenthesesPreference(
            string optionString, Optional <CodeStyleOption <ParenthesesPreference> > defaultValue)
        {
            if (TryGetCodeStyleValueAndOptionalNotification(optionString,
                                                            out var value, out var notificationOpt))
            {
                Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value));
                return(new CodeStyleOption <ParenthesesPreference>(s_parenthesesPreferenceMap.GetValueOrDefault(value),
                                                                   notificationOpt ?? NotificationOption.Silent));
            }

            return(defaultValue);
        }
Esempio n. 2
0
        private static Optional <CodeStyleOption <UnusedValuePreference> > ParseUnusedExpressionAssignmentPreference(
            string optionString,
            CodeStyleOption <UnusedValuePreference> defaultCodeStyleOption)
        {
            if (TryGetCodeStyleValueAndOptionalNotification(optionString,
                                                            out var value, out var notificationOpt))
            {
                return(new CodeStyleOption <UnusedValuePreference>(
                           s_unusedExpressionAssignmentPreferenceMap.GetValueOrDefault(value), notificationOpt ?? defaultCodeStyleOption.Notification));
            }

            return(s_preferNoneUnusedValuePreference);
        }
Esempio n. 3
0
        private static CodeStyleOption <AccessibilityModifiersRequired> ParseAccessibilityModifiersRequired(string optionString)
        {
            if (TryGetCodeStyleValueAndOptionalNotification(optionString,
                                                            out var value, out var notificationOpt))
            {
                if (value == "never")
                {
                    // If they provide 'never', they don't need a notification level.
                    notificationOpt = notificationOpt ?? NotificationOption.Silent;
                }

                if (notificationOpt != null)
                {
                    Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value));
                    return(new CodeStyleOption <AccessibilityModifiersRequired>(s_accessibilityModifiersRequiredMap.GetValueOrDefault(value), notificationOpt));
                }
            }

            return(s_requireAccessibilityModifiersDefault);
        }