示例#1
0
        /// <summary>
        /// Main process
        /// </summary>
        /// <param name="args">Command Line Arguments</param>
        static void Main(string[] args)
        {
            bool result = false;

            try
            {
                // cosole write header.
                ConsoleWriteHeader();

                if (IsConsoleWriteHelp(args))
                {
                    ConsoleWriteHelp();
                    return;
                }

                string inputPath  = ConvertArg(args, ARGS_PREFIX_INPUT_PATH);
                string outputPath = ConvertArg(args, ARGS_PREFIX_OUTPUT_PATH);
                string symbolsDir = ConvertArg(args, ARGS_PREFIX_SYMBOLS_DIR);
                string exeDir     = ConvertArg(args, ARGS_PREFIX_EXE_DIR);
                string xslPath    = ConvertArg(args, ARGS_PREFIX_XSL_PATH);

                if (!File.Exists(inputPath))
                {
                    Console.WriteLine("input file not found. ({0})", inputPath);
                    return;
                }

                Console.WriteLine("input file: {0}", inputPath);

                string inputDir = Path.GetDirectoryName(inputPath);
                CoverageInfoManager.SymPath = (string.IsNullOrEmpty(symbolsDir)) ? (inputDir) : (symbolsDir);
                CoverageInfoManager.ExePath = (string.IsNullOrEmpty(exeDir)) ? (inputDir) : (exeDir);

                CoverageInfo ci   = CoverageInfoManager.CreateInfoFromFile(inputPath);
                CoverageDS   data = ci.BuildDataSet(null);

                string outputWk = outputPath;
                if (string.IsNullOrEmpty(outputWk))
                {
                    outputWk = Path.ChangeExtension(inputPath, "xml");
                }

                Console.WriteLine("output file: {0}", outputWk);

                if (string.IsNullOrEmpty(xslPath))
                {
                    data.WriteXml(outputWk);
                }
                else
                {
                    WriteTransformXml(data, outputWk, xslPath);
                }

                result = true;

                Console.WriteLine("convert success.");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Environment.Exit((result) ? (0) : (1));
            }
        }
示例#2
0
 private static CoverageInfo GetCoverageInfo(string vstsCoverageOutputFile, string symbolsPath, string exePath)
 {
     CoverageInfoManager.SymPath = symbolsPath;
     CoverageInfoManager.ExePath = exePath;
     return(CoverageInfoManager.CreateInfoFromFile(vstsCoverageOutputFile));
 }