Ejemplo n.º 1
0
        public bool LoadSGFFile(MemFile memFile)
        {
            Sequence.Clear();

            while (!memFile.EOF)
            {
                char c = memFile.Peek();

                if (c == '(')
                {
                    SGFSequence lSGFSequence = new SGFSequence(memFile);

                    if (lSGFSequence.IsError())
                    {
                        return(SetErrorMessage(lSGFSequence));
                    }

                    Sequence.Add(lSGFSequence);
                }
                else
                {
                    memFile.Get();                      // eat this character
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        public bool Read(MemFile memFile)
        {
            char c = memFile.Get();

            if (c != '(')
            {
                return(SetErrorMessage("Expecting open-parentheses, found: " + c.ToString()));
            }

            while (true)
            {
                c = memFile.Peek();

                if (c == '(')
                {
                    SGFSequence lSGFSequence = new SGFSequence(memFile);

                    if (lSGFSequence.IsError())
                    {
                        return(SetErrorMessage(lSGFSequence));
                    }

                    AddVariation(lSGFSequence);

                    char p = memFile.Get();

                    if (p != ')')                     // eat this character
                    {
                        return(SetErrorMessage("Expecting closing-parenthese, found: " + p.ToString()));
                    }
                }
                else
                {
                    if (c == ')')
                    {
                        break;
                    }

                    if (c == ';')
                    {
                        SGFNode lSGFNode = new SGFNode(memFile);

                        if (lSGFNode.IsError())
                        {
                            return(SetErrorMessage(lSGFNode));
                        }

                        AddNode(lSGFNode);
                    }
                    else
                    {
                        memFile.Get();                          // eat this character
                    }
                }

                if (memFile.EOF)
                {
                    return(SetErrorMessage("Unexpected EOF."));
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        public bool LoadSGFFile(MemFile memFile)
        {
            Sequence.Clear();

            while (!memFile.EOF)
            {
                char c = memFile.Peek();

                if (c == '(')
                {
                    SGFSequence lSGFSequence = new SGFSequence(memFile);

                    if (lSGFSequence.IsError())
                        return SetErrorMessage(lSGFSequence);

                    Sequence.Add(lSGFSequence);
                }
                else
                    memFile.Get();	// eat this character

            }

            return true;
        }
Ejemplo n.º 4
0
        public bool Read(MemFile memFile)
        {
            char c = memFile.Get();

            if (c != '(')
                return SetErrorMessage("Expecting open-parentheses, found: " + c.ToString());

            while (true)
            {
                c = memFile.Peek();

                if (c == '(')
                {
                    SGFSequence lSGFSequence = new SGFSequence(memFile);

                    if (lSGFSequence.IsError())
                        return SetErrorMessage(lSGFSequence);

                    AddVariation(lSGFSequence);

                    char p = memFile.Get();

                    if (p != ')') // eat this character
                        return SetErrorMessage("Expecting closing-parenthese, found: " + p.ToString());

                }
                else
                {
                    if (c == ')')
                        break;

                    if (c == ';')
                    {
                        SGFNode lSGFNode = new SGFNode(memFile);

                        if (lSGFNode.IsError())
                            return SetErrorMessage(lSGFNode);

                        AddNode(lSGFNode);
                    }
                    else
                        memFile.Get();	// eat this character
                }

                if (memFile.EOF)
                    return SetErrorMessage("Unexpected EOF.");

            }

            return true;
        }