示例#1
0
        public static void Main(string[] args)
        {
            Options options = new Options();

            if (!Parser.Default.ParseArgumentsStrict(args, options, () => { }))
            {
                return;
            }
            ChartWriter.OutputFormat format;
            try
            {
                format = ChartWriter.ParseFormat(options.OutputFormat);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return;
            }
            var values =
                File.ReadLines(options.InputFile)
                .Select(line => line.Split(','))
                .Select(array => new SerializedDataPoint()
            {
                time = array[0], pef = array[1]
            });

            var parsed = DataParser.Parse(values, DataParser.ParseTimeZone(options.TimeZone))
                         .OrderBy(value => value.Time)
                         .ToArray();

            Write(parsed, format, options.OutputFile);
        }
示例#2
0
        private static void Write(IReadOnlyList <DataPoint> points, ChartWriter.OutputFormat format, string file)
        {
            var writer = new ChartWriter("template.html");
            var stream = writer.Stream(points, format);

            File.Delete(file);
            stream.CopyTo(File.OpenWrite(file));
        }