public bool Read(MemFile memFile, string propertyID)
        {
            PropertyID = propertyID;
            Text       = string.Empty;

            while (true)
            {
                char c = memFile.Get();

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

                if (c == '\\')
                {
                    c = memFile.Get();
                }

                Text = Text + c;

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

            return(true);
        }
        public bool Read(MemFile memFile)
        {
            PropertyID = string.Empty;
            Text       = string.Empty;

            while (true)
            {
                char c = memFile.Get();

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

                if (Char.IsLetter(c))
                {
                    PropertyID = PropertyID + Char.ToUpper(c);
                }

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

            while (true)
            {
                char c = memFile.Get();

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

                if (c == '\\')
                {
                    c = memFile.Get();
                }

                Text = Text + c;

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

            return(true);
        }
示例#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);
        }
示例#4
0
        public bool Read(MemFile memFile)
        {
            PropertyID = string.Empty;
            Text = string.Empty;

            while (true)
            {
                char c = memFile.Get();

                if (c == '[')
                    break;

                if (Char.IsLetter(c))
                    PropertyID = PropertyID + Char.ToUpper(c);

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

            while (true)
            {
                char c = memFile.Get();

                if (c == ']')
                    break;

                if (c == '\\')
                    c = memFile.Get();

                Text = Text + c;

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

            return true;
        }
示例#5
0
        public bool Read(MemFile memFile, string propertyID)
        {
            PropertyID = propertyID;
            Text = string.Empty;

            while (true)
            {
                char c = memFile.Get();

                if (c == ']')
                    break;

                if (c == '\\')
                    c = memFile.Get();

                Text = Text + c;

                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;
        }
        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);
        }
示例#8
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;
        }
示例#9
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;
        }
示例#10
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);
        }