public async Task SylvanDataAsync()
 {
     var tw  = TextWriter.Null;
     var dr  = TestData.GetTestDataReader();
     var csv = CsvDataWriter.Create(tw);
     await csv.WriteAsync(dr);
 }
        public void SylvanDataSync()
        {
            var tw  = TextWriter.Null;
            var dr  = TestData.GetTestDataReader();
            var csv = CsvDataWriter.Create(tw);

            csv.Write(dr);
        }
Exemple #3
0
        public override int Execute(
            CommandContext context,
            SelectSettings settings
            )
        {
            var filename = settings.File;

            Stream iStream = filename == "."
                                ? Console.OpenStandardInput()
                                : File.OpenRead(settings.File);

            var tr = new StreamReader(iStream);

            for (int i = 0; i < settings.Skip; i++)
            {
                tr.ReadLine();
            }
            var opts =
                new CsvDataReaderOptions
            {
                BufferSize = 0x100000,
            };
            var csv  = CsvDataReader.Create(tr, opts);
            var data = csv.Select(settings.Columns);

            var oStream =
                settings.Output == "."
                                ? Console.OpenStandardOutput()
                                : File.Create(settings.Output);

            var tw = new StreamWriter(oStream);
            var ww = CsvDataWriter.Create(tw);

            ww.Write(data);

            return(0);
        }