Exemple #1
0
 public AnalyzeUnusedCommand(
     AnalyzeUnusedCommandLineOptions options,
     Visibility visibility,
     UnusedSymbolKinds unusedSymbolKinds,
     string language) : base(language)
 {
     Options           = options;
     Visibility        = visibility;
     UnusedSymbolKinds = unusedSymbolKinds;
 }
Exemple #2
0
        private static async Task <int> AnalyzeUnusedAsync(AnalyzeUnusedCommandLineOptions options)
        {
            if (!options.TryGetLanguage(out string language))
            {
                return(1);
            }

            if (!options.TryGetScope(UnusedSymbolKinds.TypeOrMember, out UnusedSymbolKinds unusedSymbolKinds))
            {
                return(1);
            }

            if (!options.TryGetVisibility(Visibility.Internal, out Visibility visibility))
            {
                return(1);
            }

            var command = new AnalyzeUnusedCommand(options, visibility, unusedSymbolKinds, language);

            CommandResult result = await command.ExecuteAsync(options.Path, options.MSBuildPath, options.Properties);

            return((result.Kind == CommandResultKind.Success) ? 0 : 1);
        }