示例#1
0
        public void ExportAsXml(string destDir)
        {
            XmlExporter exporter = new XmlExporter();

            exporter.DestinationDir = destDir;
            exporter.Export(model);
        }
示例#2
0
        public void exportAsXml(string destDir)
        {
            XmlExporter exporter = new XmlExporter();

            exporter.DestinationDir = destDir;
            exporter.Export(model);
            Environment.Exit(1);
        }
示例#3
0
        private void SaveSchemaFile(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                using (FileStream stream = File.OpenWrite(dlg.FileName)) {
                    XmlExporter exporter = new XmlExporter(stream);
                    exporter.Export(DBTypeMap.Instance.AllInfos);
                }
            }
        }
示例#4
0
        private static void Main(Configuration configuration)
        {
            if (!Directory.Exists(configuration.OutputDirectory))
            {
                throw new PlainTextException("Output directory '{0}' does not exist.", configuration.OutputDirectory);
            }

            // Parse Moai code
            var parser = new MoaiParser(statusCallback: s => Console.WriteLine("[] {0}", s));

            parser.Parse(new DirectoryInfo(configuration.InputDirectory));

            // Show warning count
            if (parser.Warnings.Any())
            {
                Console.WriteLine("\nParsing resulted in {0} warnings. For more information, run DocLint.", parser.Warnings.Count);
            }

            // Export API description
            string header = string.Format(CultureInfo.InvariantCulture,
                                          "Documentation for {0} (http://getmoai.com/)\n"
                                          + "Generated on {1:yyyy-MM-dd} by {2}.\n"
                                          + CurrentUtility.MoaiUtilsHint,
                                          parser.MoaiVersionInfo, DateTime.Now, CurrentUtility.Signature);
            IApiExporter exporter;

            switch (configuration.ExportFormat)
            {
            case ExportFormat.ZeroBrane:
                exporter = new ZeroBraneExporter();
                break;

            case ExportFormat.SublimeText:
                exporter = new SublimeTextExporter();
                break;

            case ExportFormat.XML:
                exporter = new XmlExporter();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            DirectoryInfo outputDirectory = new DirectoryInfo(configuration.OutputDirectory);

            exporter.Export(parser.DocumentedClasses.ToArray(), header, outputDirectory);

            Console.WriteLine("\nGenerated Moai documentation in {0} format in '{1}'.",
                              configuration.ExportFormat, outputDirectory.FullName);
        }
示例#5
0
        private static void Export(object sender, ExecutedRoutedEventArgs e)
        {
            Main           main       = (Main)sender;
            SaveFileDialog saveDialog = new SaveFileDialog();

            saveDialog.DefaultExt   = ".xml";
            saveDialog.Title        = "Export to...";
            saveDialog.AddExtension = true;
            if (saveDialog.ShowDialog(main).Value)
            {
                using (FileStream stream = new FileStream(saveDialog.FileName, FileMode.Create, FileAccess.Write))
                {
                    XmlExporter.Export(stream);
                }
            }
        }
示例#6
0
        public static void Main(string[] args)
        {
            // Test link to the Db
            var context = new GeographyEntities();
            //var continentsQuery = context.Continents.Select(c => c.ContinentName);

            //foreach (var continent in continentsQuery)
            //{
            //    Console.WriteLine(continent);
            //}

            // Export Rivers to JSON
            var riversQuery =
                context.Rivers
                .OrderByDescending(r => r.Length)
                .Select(
                    r =>
                    new RiversDto
            {
                RiverName   = r.RiverName,
                RiverLength = r.Length,
                Countries   = r.Countries
                              .OrderBy(c => c.CountryName)
                              .Select(c => c.CountryName)
            }).ToList();
            var filePathNameJson = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\Rivers.json";

            JsonExporter.Export(filePathNameJson, riversQuery);

            // Export Monasteries by Country as XML
            var countriesWMonasteriesQuery = context.Countries
                                             .OrderBy(c => c.CountryName)
                                             .Where(c => c.Monasteries.Any())
                                             .Select(c => new CountriesDto()
            {
                CountryName = c.CountryName,
                Monasteries = c.Monasteries.Select(m => m.Name)
            }).ToList();

            var filePathNameXml = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Monasteries.xml";

            XmlExporter.Export(filePathNameXml, countriesWMonasteriesQuery);
        }
示例#7
0
        private static int handleExportXml(MonoCovOptions opts,string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Error: Datafile name is required when using --export-xml");
                return(1);
            }

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

            CoverageModel model = new CoverageModel();

            model.ReadFromFile(args [0]);
            XmlExporter exporter = new XmlExporter();

            exporter.DestinationDir = opts.exportXmlDir;
            exporter.StyleSheet     = opts.styleSheet;
            if (!opts.quiet)
            {
                exporter.Progress += new XmlExporter.ProgressEventHandler(progressListener);
            }
            exporter.Export(model);
            if (!opts.quiet)
            {
                Console.WriteLine();
                Console.WriteLine("Done.");
            }
            return(0);
        }
示例#8
0
        public string ExportToXml(IList <Currency> currencies)
        {
            IExporter exporter = new XmlExporter();

            return(exporter.Export(currencies));
        }
示例#9
0
	public void ExportAsXml (string destDir)
	{
		XmlExporter exporter = new XmlExporter ();
		exporter.DestinationDir = destDir;
		exporter.Export (model);
		Environment.Exit (1);
	}
示例#10
0
文件: MonoCov.cs 项目: mono/monocov
        private static int handleExportXml(MonoCovOptions opts, string[] args)
        {
            if (args.Length == 0) {
            Console.WriteLine ("Error: Datafile name is required when using --export-xml");
            return 1;
            }

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

            CoverageModel model = new CoverageModel ();
            model.ReadFromFile (args [0]);
            XmlExporter exporter = new XmlExporter ();
            exporter.DestinationDir = opts.exportXmlDir;
            exporter.StyleSheet = opts.styleSheet;
            if (!opts.quiet)
            exporter.Progress += new XmlExporter.ProgressEventHandler (progressListener);
            exporter.Export (model);
            if (!opts.quiet) {
            Console.WriteLine ();
            Console.WriteLine ("Done.");
            }
            return 0;
        }
示例#11
0
        static async Task Main(string[] args)
        {
            TcmbCurrencyDataService tcmbCurrencyDataService = new TcmbCurrencyDataService(new TcmbDownloader());

            List <TcmbCurrencyData> tcmbCurrencyDataForCsvExport1 = await tcmbCurrencyDataService.GetCurrencyData();

            List <TcmbCurrencyData> tcmbCurrencyDataForCsvExport2 = await tcmbCurrencyDataService.GetCurrencyData();

            CsvExporter csvExporter  = new CsvExporter(new SortByNameStrategy());
            CsvExporter csvExporter2 = new CsvExporter(new DefaultSortingStrategy());
            string      csvAsString  = csvExporter.Export(tcmbCurrencyDataForCsvExport1);
            string      csvAsString2 = csvExporter2.Export(tcmbCurrencyDataForCsvExport2);

            List <TcmbCurrencyData> tcmbCurrencyDataForXmlExport1 = await tcmbCurrencyDataService.GetCurrencyData();

            List <TcmbCurrencyData> tcmbCurrencyDataForXmlExport2 = await tcmbCurrencyDataService.GetCurrencyData();

            XmlExporter xmlExporter  = new XmlExporter(new SortByNameStrategy());
            XmlExporter xmlExporter2 = new XmlExporter(new SortByForexSelling());
            string      xmlAsString  = xmlExporter.Export(tcmbCurrencyDataForXmlExport1);
            string      xmlAsString2 = xmlExporter2.Export(tcmbCurrencyDataForXmlExport2);

            Sorter sorter = new Sorter();

            List <TcmbCurrencyData> tcmbCurrencyData = await tcmbCurrencyDataService.GetCurrencyData();

            List <TcmbCurrencyData> tcmbCurrencyData1 = sorter.SortByBanknoteBuying(tcmbCurrencyData);

            Console.WriteLine("Data sorted by BanknoteBuying property are shown below (Ascending):\n");
            foreach (var item in tcmbCurrencyData1)
            {
                if (item.BanknoteBuying.HasValue)
                {
                    Console.WriteLine(item.BanknoteBuying);
                }
            }

            List <TcmbCurrencyData> tcmbCurrencyData2 = sorter.SortByBanknoteBuyingDescending(tcmbCurrencyData);

            Console.WriteLine("\nData sorted by BanknoteBuying property are shown below (Descending):\n");
            foreach (var item in tcmbCurrencyData2)
            {
                if (item.BanknoteBuying.HasValue)
                {
                    Console.WriteLine(item.BanknoteBuying);
                }
            }

            List <TcmbCurrencyData> tcmbCurrencyData3 = tcmbCurrencyData.FilterByCode("USD");

            Console.WriteLine("\nData filtered by CurrencyCode property with the text 'USD' and sorted by CrossOrder property are shown below (Ascending):\n");
            foreach (var item in tcmbCurrencyData3)
            {
                if (item.BanknoteBuying.HasValue)
                {
                    Console.WriteLine(item.BanknoteBuying);
                }
            }

            List <TcmbCurrencyData> tcmbCurrencyData4 = tcmbCurrencyData.ExcludeNullCrossRateUsd();

            Console.WriteLine("\nData filtered by excluding null CrossRateUsd property and sorted by CrossOrder property are shown below (Ascending):\n");
            foreach (var item in tcmbCurrencyData4)
            {
                if (item.BanknoteBuying.HasValue)
                {
                    Console.WriteLine(item.BanknoteBuying);
                }
            }
        }