Esempio n. 1
0
        public static bool TryParseUnusedSymbolKinds(IEnumerable <string> values, out UnusedSymbolKinds kinds)
        {
            if (!values.Any())
            {
                kinds = UnusedSymbolKinds.TypeOrMember;
                return(true);
            }

            kinds = UnusedSymbolKinds.None;

            foreach (string value in values)
            {
                if (Enum.TryParse(value.Replace("-", ""), ignoreCase: true, out UnusedSymbolKinds result))
                {
                    kinds |= result;
                }
                else
                {
                    WriteLine($"Unknown unused symbol kind '{value}'.", Verbosity.Quiet);
                    return(false);
                }
            }

            return(true);
        }
        internal bool TryGetScope(UnusedSymbolKinds defaultValue, out UnusedSymbolKinds value)
        {
            if (Scope.Any())
            {
                return(ParseHelpers.TryParseUnusedSymbolKinds(Scope, out value));
            }

            value = defaultValue;
            return(true);
        }
Esempio n. 3
0
 public AnalyzeUnusedCommand(
     AnalyzeUnusedCommandLineOptions options,
     Visibility visibility,
     UnusedSymbolKinds unusedSymbolKinds,
     string language) : base(language)
 {
     Options           = options;
     Visibility        = visibility;
     UnusedSymbolKinds = unusedSymbolKinds;
 }