예제 #1
0
        static async Task Main(string[] args)
        {
            PrintInfo();

            if (args.Length < 1)
            {
                Console.WriteLine("first arg must be the trx-file");
                Environment.Exit(1);
            }

            try
            {
                var worker  = new Worker();
                var options = WorkerOptions.Parse(args);
                await worker.RunAsync(options);
            }
            catch (Exception ex) when(!Debugger.IsAttached)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Error.WriteLine(ex.Message);
                Console.ResetColor();
                Environment.Exit(2);
            }

            if (Debugger.IsAttached)
            {
                Console.ReadKey();
            }
        }
예제 #2
0
        //---------------------------------------------------------------------
        public async Task RunAsync(WorkerOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            Thread.CurrentThread.CurrentCulture   = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            Console.WriteLine($"Converting {options.InputFiles.Count} trx file(s) to JUnit-xml...");
            DateTime start = DateTime.Now;

            await Task.WhenAll(options.InputFiles.Select(trx => this.Convert(trx, options.OutputDirectory)));

            Console.WriteLine($"done in {(DateTime.Now - start).TotalSeconds} seconds. bye.");
        }