Beispiel #1
0
        private void Do(DirectoryInfo di, SearchOption searchOption)
        {
            foreach (var f in di.GetFiles("*", searchOption))
            {
                // 处理
                string s = f.FullName.Replace(strInput, strOutput) + ".csv";

                AppendText(s + " - ");

                if (bSkip)
                {
                    if (new FileInfo(s).Exists)
                    {
                        AppendText("存在" + Environment.NewLine);
                        continue;
                    }
                }

                try
                {
                    PbTickSerializer.WriteCsv(PbTickSerializer.Read(f.FullName), s);
                    AppendText("成功" + Environment.NewLine);
                }
                catch (Exception ex)
                {
                    AppendText("失败" + Environment.NewLine);
                }
            }
        }
Beispiel #2
0
        private void ReadFromFile(string pathChosen)
        {
            Tuple <Stream, string, double> tuple = ReadToStream(pathChosen);

            if (tuple == null)
            {
                return;
            }

            Stream stream = tuple.Item1;

            try
            {
                listTickData = PbTickSerializer.Read(stream);

                strCurrentFileName = string.Format("{0} ({1}/{2}={3})",
                                                   tuple.Item2, tuple.Item3, listTickData.Count(), tuple.Item3 / listTickData.Count());

                ValueChanged(false);

                PbTickCodec Codec = new PbTickCodec();

                listTickView       = Codec.Data2View(this.listTickData, true);
                dgvTick.DataSource = this.listTickView;

                SingleCheck(menuView_Diff);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }