blob: 2e36aef7de847f3f4279d32bb71809ea51076b0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace Aktywator
{
class PBN
{
public HandRecord[] handRecords;
public DDTable[] ddTables;
protected int lowBoard;
protected int highBoard;
private int _count;
public int count
{
get { return _count; }
}
private String _title;
public String title
{
get { return _title; }
}
public PBN(string filename, int lowBoard, int highBoard)
{
this.handRecords = new HandRecord[highBoard + 1];
this.ddTables = new DDTable[highBoard + 1];
this.lowBoard = lowBoard;
this.highBoard = highBoard;
this._count = 0;
PBNFile pbn = new PBNFile(filename);
foreach (PBNBoard board in pbn.Boards)
{
int boardNo = Int32.Parse(board.GetNumber());
if (lowBoard <= boardNo && boardNo <= highBoard)
{
this.handRecords[boardNo] = new HandRecord(board.GetLayout());
this.ddTables[boardNo] = new DDTable(board);
this._count++;
}
}
if (this._count == 0)
{
throw new Exception("PBN nie zawiera rozdań z zadanego przedziału");
}
if (pbn.Boards.Count > 0 && pbn.Boards[0].HasField("Event"))
{
this._title = pbn.Boards[0].GetField("Event");
}
}
}
}
|