コード例 #1
0
        public bool ConvertFiles(DoubleDel progress)
        {
            bool ok  = true;
            int  c   = 1;
            int  max = Files.Length;

            // foreach file
            foreach (string fn in Files)
            {
                // read the file
                var csv = Util.getfile(fn, debug);
                // update progress
                progress((double)c++ / max);
                ok &= !string.IsNullOrWhiteSpace(csv);
                if (!ok)
                {
                    debug("Error reading: " + fn);
                    continue;
                }
                // parse data
                var data = Util.ParseCsvData(csv, debug);
                // convert it
                var ks = convert(data);
                ok &= ks.Count > 0;
                if (!ok)
                {
                    debug("No ticks converted in: " + fn);
                    continue;
                }
                // write to ticks
                ok &= TikUtil.TicksToFile(ks.ToArray(), debug);

                // update status
                if (!ok)
                {
                    debug("Error writing ticks to TIK file.");
                }
            }
            return(ok);
        }
コード例 #2
0
        public bool ConvertFiles(DoubleDel progress)
        {
            bool ok = true;
            int c = 1;
            int max = Files.Length;
            // foreach file
            foreach (string fn in Files)
            {
                // read the file
                var csv = Util.getfile(fn, debug);
                // update progress
                progress((double)c++ / max);
                ok &= !string.IsNullOrWhiteSpace(csv);
                if (!ok)
                {
                    debug("Error reading: " + fn);
                    continue;
                }
                // parse data
                var data = Util.ParseCsvData(csv, debug);
                // convert it
                var ks = convert(data);
                ok &= ks.Count > 0;
                if (!ok)
                {
                    debug("No ticks converted in: " + fn);
                    continue;
                }
                // write to ticks
                ok &= TikUtil.TicksToFile(ks.ToArray(), debug);

                // update status
                if (!ok)
                    debug("Error writing ticks to TIK file.");
            }
            return ok;
        }