コード例 #1
0
        private static int Main(string[] args)
        {
            ConsoleLogger logger = new ConsoleLogger();

            Utilities.LogAssemblyVersion(typeof(Program).Assembly, UIResources.Program_AssemblyDescription, logger);
            Utilities.LogAssemblyVersion(typeof(DiagnosticAnalyzer).Assembly, UIResources.Program_SupportedRoslynVersion, logger);
            logger.LogInfo(UIResources.Program_SupportedSonarQubeVersions);

            ProcessedArgs processedArgs = ArgumentProcessor.TryProcessArguments(args, logger);

            bool success = false;

            if (processedArgs != null)
            {
                string localNuGetCache = Utilities.CreateTempDirectory(".nuget");
                var    defaultNuGetDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                var    repo            = NuGetRepositoryFactory.CreateRepositoryForArguments(logger, processedArgs, defaultNuGetDir);
                var    packageHandler  = new NuGetPackageHandler(repo, localNuGetCache, logger);

                AnalyzerPluginGenerator generator = new AnalyzerPluginGenerator(packageHandler, logger);
                success = generator.Generate(processedArgs);
            }

            return(success ? SUCCESS_CODE : ERROR_CODE);
        }
コード例 #2
0
        static int Main(string[] args)
        {
            ConsoleLogger logger = new ConsoleLogger();

            Utilities.LogAssemblyVersion(typeof(Program).Assembly, UIResources.AssemblyDescription, logger);

            ProcessedArgs processedArgs = ArgumentProcessor.TryProcessArguments(args, logger);

            bool success = false;

            if (processedArgs != null)
            {
                string              exeDir          = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                ISettings           nuGetSettings   = NuGetRepositoryFactory.GetSettingsFromConfigFiles(exeDir);
                IPackageRepository  repo            = NuGetRepositoryFactory.CreateRepository(nuGetSettings, logger);
                string              localNuGetCache = Utilities.CreateTempDirectory(".nuget");
                NuGetPackageHandler packageHandler  = new NuGetPackageHandler(repo, localNuGetCache, logger);

                AnalyzerPluginGenerator generator = new AnalyzerPluginGenerator(packageHandler, logger);
                success = generator.Generate(processedArgs);
            }

            return(success ? SUCCESS_CODE : ERROR_CODE);
        }