示例#1
0
 public void StepParsed(IPgnReader iParser)
 {
     if (iParser.State == Enums.PGNReaderState.Number)
     {
         _lastNumber = iParser.Value;
     }
     else if (iParser.State == Enums.PGNReaderState.White)
     {
         _tmpStep          = new Step();
         _tmpStep.Number   = int.Parse(_lastNumber);
         _tmpStep.GameSide = Enums.GameSide.White;
         _tmpStep.Parse(iParser.Value);
         _tmpStepTree.Items.Add(_tmpStep);
     }
     else if (iParser.State == Enums.PGNReaderState.Black)
     {
         if (string.IsNullOrEmpty(iParser.Value))
         {
             return;
         }
         _tmpStep          = new Step();
         _tmpStep.Number   = int.Parse(_lastNumber);
         _tmpStep.GameSide = Enums.GameSide.Black;
         _tmpStep.Parse(iParser.Value);
         _tmpStepTree.Items.Add(_tmpStep);
     }
 }
示例#2
0
 public void EnterVariation(IPgnReader iParser)
 {
     _states.Push(_lastNumber);
     if (_tmpStep != null)
     {
         _tmpStep.Parent = (IChessItem)_tmpStepTree;
         _tmpStepTree    = _tmpStep;
         if (_tmpStepTree.Items == null)
         {
             _tmpStepTree.Items = new Variation();
         }
         //_tmpStepTree.Items.Add(_tmpStep);
         _tmpStep = null;
     }
     else
     {
         IStepTree tmpTree = null;
         int       i       = 1;
         while (!(_tmpStepTree.Items[_tmpStepTree.Items.Count - i] is IStepTree))
         {
             i++;
         }
         tmpTree        = (IStepTree)_tmpStepTree.Items[_tmpStepTree.Items.Count - i];
         tmpTree.Parent = (IChessItem)_tmpStepTree;
         _tmpStepTree   = tmpTree;
     }
     if (_tmpStepTree.Items == null)
     {
         _tmpStepTree.Items = new Steps();
     }
 }
示例#3
0
 public void ExitVariation(IPgnReader iParser)
 {
     if (iParser.State != Enums.PGNReaderState.Number)
     {
         StepParsed(iParser);
     }
     _tmpStepTree = (IStepTree)_tmpStepTree.Parent;
     _lastNumber  = (string)_states.Pop();
 }
示例#4
0
 public void TagParsed(IPgnReader iParser)
 {
     try
     {
         ((Record)_tmpStepTree).Tags.Add(iParser.Tag, iParser.Value);
     }
     catch (RecordException e)
     {
         throw e;
     }
 }
示例#5
0
        public void NagParsed(IPgnReader iParser)
        {
            if (_tmpStep != null)
            {
                _tmpStepTree.Items.Add(_tmpStep);
                _tmpStep = null;
            }
            Nag nag = new Nag(iParser.Value);

            _tmpStepTree.Items.Add(nag);
        }
示例#6
0
 public void Finished(IPgnReader iParser)
 {
     _states = new Stack();
 }
示例#7
0
 public void Starting(IPgnReader iParser)
 {
 }
示例#8
0
 public void ExitHeader(IPgnReader iParser)
 {
 }
示例#9
0
 public void NewGame(IPgnReader iParser)
 {
     _states      = new Stack();
     _tmpStepTree = new Record();
     _ChessRecords.Add((Record)_tmpStepTree);
 }
示例#10
0
        public void EndMarker(IPgnReader iParser)
        {
            GameResult end = GameResult.Parse(iParser.Value);

            _tmpStepTree.Items.Add(end);
        }
示例#11
0
 public void CommentParsed(IPgnReader iParser)
 {
     _tmpComment = Annotation.Parse(iParser.Value);
     _tmpStepTree.Items.Add(_tmpComment);
 }