Execute() публичный Метод

public Execute ( ) : bool
Результат bool
Пример #1
0
        public static int ProcessCreate(CommandLineArgs args)
        {
            try
            {
                IEnumerable<string> inputPaths = GetInputFiles(args);
                string outputPath = "CustomInstrumentation.xml";

                if (!string.IsNullOrWhiteSpace(args.OutputFile))
                {
                    outputPath = args.OutputFile;
                }

                var generator = new CustomInstrumentationGenerator(inputPaths, outputPath);
                if (args.ForceIfNotMarkedUpValid)
                {
                    generator.AutomaticInstrumentationScopes = args.ForceIfNotMarkedUpValidScopes;
                }

                generator.UseReflectionBasedDiscovery = args.LegacyMode;
                generator.ContinueOnFailure = args.ContinueOnFailure;
                generator.IncludeCompilerGeneratedCode = args.IncludeCompilerGeneratedCode ?? false;

                bool result = generator.Execute();

                return result ? RETURN_SUCCESS : RETURN_FAILURE;
            }
            catch (Exception ex)
            {
                ErrorOut("Failed to process instrumentation: {0}", ex, args.Verbose || args.VeryVerbose);
                return RETURN_FAILURE;
            }
        }
        public override bool Execute()
        {
            LogConfigurator.Configure(true, true, new BuildTaskLogAppender(this.Log));

            var toReturn = true;

            if (this.InputFiles != null && this.InputFiles.Any())
            {
                IEnumerable <string> inputFiles =
                    this
                    .InputFiles
                    .Where(x => !string.IsNullOrWhiteSpace(x.ItemSpec))
                    .Select(x => x.ItemSpec)
                    .ToList();

                string outputFile = "CustomInstrumentation.xml";
                if (this.OutputFile != null && !string.IsNullOrWhiteSpace(this.OutputFile.ItemSpec))
                {
                    outputFile = this.OutputFile.ItemSpec;
                }

                var generator = new CustomInstrumentationGenerator(inputFiles, outputFile);
                generator.ContinueOnFailure = true;

                try
                {
                    toReturn        = generator.Execute();
                    this.OutputFile = new TaskItem(outputFile);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex);
                    toReturn = false;
                }
            }
            else
            {
                toReturn = false;
            }

            return(toReturn);
        }
        public override bool Execute()
        {
            LogConfigurator.Configure(true, true, new BuildTaskLogAppender(this.Log));

            var toReturn = true;

            if (this.InputFiles != null && this.InputFiles.Any())
            {
                IEnumerable<string> inputFiles =
                    this
                    .InputFiles
                    .Where(x => !string.IsNullOrWhiteSpace(x.ItemSpec))
                    .Select(x => x.ItemSpec)
                    .ToList();

                string outputFile = "CustomInstrumentation.xml";
                if (this.OutputFile != null && !string.IsNullOrWhiteSpace(this.OutputFile.ItemSpec))
                {
                    outputFile = this.OutputFile.ItemSpec;
                }

                var generator = new CustomInstrumentationGenerator(inputFiles, outputFile);
                generator.ContinueOnFailure = true;

                try
                {
                    toReturn = generator.Execute();
                    this.OutputFile = new TaskItem(outputFile);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex);
                    toReturn = false;
                }
            }
            else
            {
                toReturn = false;
            }

            return toReturn;
        }