static void Main(string[] args)
        {
            // parse arguments
            AdapterParams ap = AdapterParams.ParseArgs(args);

            if (ap.MeasId == null)
            {
                ConsoleUtils.FlushChunks("");
                return;
            }

            // fetch data
            List <double> data = EdnaFetcher.FetchHistData(ap.MeasId, ap.FromTime, ap.ToTime, ap.Secs, ap.Type, ap.IncludeQuality);

            // create output string
            string outStr = string.Join(",", data.Select(d => d.ToString()));

            ConsoleUtils.FlushChunks(outStr);
        }
        public static AdapterParams ParseArgs(string[] args)
        {
            // read arguments for meas_id, from_time, to_time, host, port, path, username, password, ref_meas_id

            AdapterParams ap = new AdapterParams();

            for (int argIter = 0; argIter < args.Length; argIter++)
            {
                // Console.WriteLine(args[argIter]);
                if (args[argIter] == "--meas_id")
                {
                    ap.MeasId = args[argIter + 1];
                }
                else if (args[argIter] == "--from_time")
                {
                    ap.FromTime = TimeUtils.FromMillisecondsSinceUnixEpoch(long.Parse(args[argIter + 1]));
                }
                else if (args[argIter] == "--to_time")
                {
                    ap.ToTime = TimeUtils.FromMillisecondsSinceUnixEpoch(long.Parse(args[argIter + 1]));
                }
                else if (args[argIter] == "--type")
                {
                    ap.Type = args[argIter + 1];
                }
                else if (args[argIter] == "--secs")
                {
                    ap.Secs = int.Parse(args[argIter + 1]);
                }
                else if (args[argIter] == "--include_quality")
                {
                    ap.IncludeQuality = true;
                }
            }
            return(ap);
        }