コード例 #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);
        }
コード例 #2
0
ファイル: SGFNode.cs プロジェクト: tgiphil/GoTraxx
        public bool Read(MemFile memFile)
        {
            char c = memFile.Get();

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

            while (true)
            {
                if (memFile.EOF)
                    return true;

                c = memFile.Peek();

                if (c == '(')
                    break;	// variation

                if ((c == ';') || (c == ')'))
                    break;

                if (Char.IsLetter(c))
                {
                    SGFProperty lSGFProperty = new SGFProperty(memFile);

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

                    AddProperty(lSGFProperty);

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

                        if (c == ')')
                            break;

                        if (c == '(')
                            break;

                        if (c == '[')
                        {
                            memFile.Get(); // eat this character

                            SGFProperty lSGFProperty2 = new SGFProperty(memFile, lSGFProperty.PropertyID);

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

                            AddProperty(lSGFProperty2);
                        }
                        else
                            if (!Char.IsLetter(c))
                            {
                                memFile.Get();	// eat this character

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

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

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

            }

            return true;
        }
コード例 #3
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);
        }
コード例 #4
0
ファイル: SGFCollection.cs プロジェクト: tgiphil/GoTraxx
        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;
        }
コード例 #5
0
ファイル: SGFSequence.cs プロジェクト: tgiphil/GoTraxx
        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;
        }
コード例 #6
0
        public bool Read(MemFile memFile)
        {
            char c = memFile.Get();

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

            while (true)
            {
                if (memFile.EOF)
                {
                    return(true);
                }

                c = memFile.Peek();

                if (c == '(')
                {
                    break;                      // variation
                }
                if ((c == ';') || (c == ')'))
                {
                    break;
                }

                if (Char.IsLetter(c))
                {
                    SGFProperty lSGFProperty = new SGFProperty(memFile);

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

                    AddProperty(lSGFProperty);

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

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

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

                        if (c == '[')
                        {
                            memFile.Get();                             // eat this character

                            SGFProperty lSGFProperty2 = new SGFProperty(memFile, lSGFProperty.PropertyID);

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

                            AddProperty(lSGFProperty2);
                        }
                        else
                        if (!Char.IsLetter(c))
                        {
                            memFile.Get();                                      // eat this character

                            if (memFile.EOF)
                            {
                                return(SetErrorMessage("Unexpected EOF."));
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else
                {
                    memFile.Get();                      // eat this character
                }
                if (memFile.EOF)
                {
                    return(SetErrorMessage("Unexpected EOF."));
                }
            }

            return(true);
        }