Exemplo n.º 1
0
        private static void MarkRecords(Records records)
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();
            records = new Records();
            MyDemoDialog.Clear();
            PGNReader reader = new PGNReader();

            //reader.Filename = Program.PGNFile_CHS_Game;
            reader.Filename = Program.PGNFile_Test_2_Game;
            //reader.Filename = @"e:\ChessBase\Bases\08a.pgn";
            reader.AddEvents(records);
            reader.Parse();
            watch.Stop();
            double rTime = watch.ElapsedMilliseconds;//总时间
            double fTIme = rTime / records.Count;

            MyDemoDialog.StatusText1 = string.Format("记录个数:{2}, 总时间:{0},每个记录的解析时间为:{1}", rTime, fTIme, records.Count);

            MyDemoDialog.RecordTree.BeginUpdate();
            foreach (Record record in records)
            {
                TreeNode node = new TreeNode();
                node.Text = (string)record.Tags.Get("Event");
                node.Tag  = record;
                MyDemoDialog.RecordTree.Nodes.Add(node);
            }
            MyDemoDialog.RecordTree.EndUpdate();
        }
Exemplo n.º 2
0
        //F5:针对PGN文件进行转换与解析
        private void PGNConvent(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            Duration duration = new Duration();

            duration.Start();
            PGNReader reader = new PGNReader();

            reader.Filename = Path.GetFullPath(Path.Combine(_demoFile, PGNFile));
            reader.AddEvents(_records);
            reader.Parse();
            string s = _records[0].ToString();

            this._recordListView.Items.Clear();
            foreach (var item in _records)
            {
                this._recordListView.Add(item);
            }
            duration.Stop();
            this._label.Text = string.Format("[Count: {0} record]. [Duration time: {1}]. [{2} Time/Record.]",
                                             _records.Count, duration.DurationValue, duration.DurationValue / _records.Count);
            this.Cursor = Cursors.Default;
        }