示例#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();
        }
示例#2
0
        //F5:针对PGN文件进行转换与解析
        private void PGNConvent(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            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);
            }
            this._label.Text = $"[Count: {_records.Count} record].";
            this.Cursor      = Cursors.Default;
        }