Export() public method

public Export ( CoverageModel model ) : void
model CoverageModel
return void
示例#1
0
        private static int handleExportHtml(MonoCovOptions opts, string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Error: Datafile name is required when using --export-html");
                return(1);
            }

            if (!File.Exists(args [0]))
            {
                Console.WriteLine(string.Format("Error: Datafile '{0}' not found.", args [0]));
                return(1);
            }

            if (!Directory.Exists(opts.exportHtmlDir))
            {
                try {
                    Directory.CreateDirectory(opts.exportHtmlDir);
                }
                catch (Exception ex) {
                    Console.WriteLine("Error: Destination directory '" + opts.exportHtmlDir + "' does not exist and could not be created: " + ex);
                    return(1);
                }
            }

            try {
                CoverageModel model = new CoverageModel();
                model.ReadFromFile(args [0]);
                HtmlExporter exporter = new HtmlExporter();
                exporter.DestinationDir = opts.exportHtmlDir;
                exporter.StyleSheet     = opts.styleSheet;
                if (!opts.quiet)
                {
                    exporter.Progress += new HtmlExporter.ProgressEventHandler(htmlProgressListener);
                }
                exporter.Export(model);
            }
            catch (Exception e) {
                Console.WriteLine("Error: " + e.Message);
                return(1);
            }

            if (!opts.quiet)
            {
                Console.WriteLine();
                Console.WriteLine("Done.");
            }
            return(0);
        }
示例#2
0
        private static int handleExportHtml(MonoCovOptions opts, string[] args)
        {
            if (args.Length == 0) {
            Console.WriteLine ("Error: Datafile name is required when using --export-html");
            return 1;
            }

            if (!File.Exists(args [0])) {
            Console.WriteLine(string.Format("Error: Datafile '{0}' not found.", args [0]));
            return 1;
            }

            if (!Directory.Exists (opts.exportHtmlDir)) {
            try {
                Directory.CreateDirectory (opts.exportHtmlDir);
            }
            catch (Exception ex) {
                Console.WriteLine ("Error: Destination directory '" + opts.exportHtmlDir + "' does not exist and could not be created: " + ex);
                return 1;
            }
            }

            try {
            CoverageModel model = new CoverageModel ();
            model.ReadFromFile (args [0]);
            HtmlExporter exporter = new HtmlExporter ();
            exporter.DestinationDir = opts.exportHtmlDir;
            exporter.StyleSheet = opts.styleSheet;
            if (!opts.quiet)
                exporter.Progress += new HtmlExporter.ProgressEventHandler (htmlProgressListener);
            exporter.Export (model);
            }
            catch (Exception e) {
            Console.WriteLine("Error: "+e.Message);
            return 1;
            }

            if (!opts.quiet) {
            Console.WriteLine ();
            Console.WriteLine ("Done.");
            }
            return 0;
        }