public override void Parse(StreamReader inStream, String line, PayParserState parseState)
        {
            bool lineHasOpenBrace = false;
            bool lineHasCloseBrace = false;

            PaylineDescription payline;

            using (inStream)
            {
                while ((line = inStream.ReadLine()) != null)
                {
                    // strip comments
                    if (line.Contains("/"))
                    {
                        int pos = line.IndexOf("/");
                        line = line.Remove(pos);
                    }

                    line = line.Trim();

                    if (line.Length == 0 || line == "")
                        continue;

                    // check for braces
                    if (line == m_util.openBrace)
                    {
                        parseState.EnterArrayLevel();
                        continue;
                    }

                    lineHasOpenBrace = line.Contains(m_util.openBrace);
                    lineHasCloseBrace = line.Contains(m_util.closeBrace);

                    if (!lineHasOpenBrace && !lineHasCloseBrace)
                        continue;

                    if (lineHasCloseBrace)
                    {
                        if (line == m_util.closeBrace)
                        {
                            parseState.LeaveArrayLevel();
                            if (parseState.FreeLinePayStart)
                            {
                                if (parseState.StateEnteredLevel[(int)PayReadState.FREEGAME_LINEPAYSTART] == parseState.ArrayDepth)
                                    parseState.LeaveFreeLinePay();
                            }
                            break;
                        }

                        // could be end of a reelstop definition, or moving up a level
                        if (line == m_util.arrayEnd)
                        {
                            parseState.LeaveArrayLevel();
                            if (parseState.FreeLinePayStart)
                            {
                                if (parseState.StateEnteredLevel[(int)PayReadState.FREEGAME_LINEPAYSTART] == parseState.ArrayDepth)
                                    parseState.LeaveFreeLinePay();
                            }
                            break;
                        }
                    }

                    payline = new PaylineDescription();
                    payline.Add(line, m_util);
                    if (parseState.FreeLinePayStart)
                    {
                        m_freeLinePays.Add(payline);
                    }
                    else
                    {
                        parseState.ResetFreeLinePay();
                        break;
                    }
                }
            }

            IComparer<PaylineDescription> payComparer = new PaylineSorter();
            m_freeLinePays.Sort(payComparer);
        }
        public override void Parse(StreamReader inStream, String line, PayParserState parseState)
        {
            bool lineHasOpenBrace  = false;
            bool lineHasCloseBrace = false;

            PaylineDescription payline;

            using (inStream)
            {
                while ((line = inStream.ReadLine()) != null)
                {
                    // strip comments
                    if (line.Contains("/"))
                    {
                        int pos = line.IndexOf("/");
                        line = line.Remove(pos);
                    }

                    line = line.Trim();

                    if (line.Length == 0 || line == "")
                    {
                        continue;
                    }

                    // check for braces
                    if (line == m_util.openBrace)
                    {
                        parseState.EnterArrayLevel();
                        continue;
                    }

                    lineHasOpenBrace  = line.Contains(m_util.openBrace);
                    lineHasCloseBrace = line.Contains(m_util.closeBrace);

                    if (!lineHasOpenBrace && !lineHasCloseBrace)
                    {
                        continue;
                    }

                    if (lineHasCloseBrace)
                    {
                        if (line == m_util.closeBrace)
                        {
                            parseState.LeaveArrayLevel();
                            if (parseState.FreeLinePayStart)
                            {
                                if (parseState.StateEnteredLevel[(int)PayReadState.FREEGAME_LINEPAYSTART] == parseState.ArrayDepth)
                                {
                                    parseState.LeaveFreeLinePay();
                                }
                            }
                            break;
                        }

                        // could be end of a reelstop definition, or moving up a level
                        if (line == m_util.arrayEnd)
                        {
                            parseState.LeaveArrayLevel();
                            if (parseState.FreeLinePayStart)
                            {
                                if (parseState.StateEnteredLevel[(int)PayReadState.FREEGAME_LINEPAYSTART] == parseState.ArrayDepth)
                                {
                                    parseState.LeaveFreeLinePay();
                                }
                            }
                            break;
                        }
                    }

                    payline = new PaylineDescription();
                    payline.Add(line, m_util);
                    if (parseState.FreeLinePayStart)
                    {
                        m_freeLinePays.Add(payline);
                    }
                    else
                    {
                        parseState.ResetFreeLinePay();
                        break;
                    }
                }
            }

            IComparer <PaylineDescription> payComparer = new PaylineSorter();

            m_freeLinePays.Sort(payComparer);
        }
Example #3
0
        private void parseSymbols(StreamReader inStream, String line)
        {
            bool lineHasOpenBrace  = false;
            bool lineHasCloseBrace = false;
            bool lineHasComma      = false;

            String[] parts;
            String   symbol = "";

            using (inStream)
            {
                while ((line = inStream.ReadLine()) != null)
                {
                    // strip comments
                    if (line.Contains("/"))
                    {
                        int pos = line.IndexOf("/");
                        line = line.Remove(pos);
                    }

                    line = line.Trim();

                    if (line.Length == 0 || line == "")
                    {
                        continue;
                    }

                    // check for braces
                    if (line == m_util.openBrace)
                    {
                        m_parseState.EnterArrayLevel();
                        continue;
                    }

                    lineHasOpenBrace  = line.Contains(m_util.openBrace);
                    lineHasCloseBrace = line.Contains(m_util.closeBrace);
                    lineHasComma      = line.Contains(","); // some paytable.cfg files don't use multi-value symbols so no braces

                    if (!lineHasOpenBrace && !lineHasCloseBrace && !lineHasComma)
                    {
                        continue;
                    }

                    if (lineHasCloseBrace)
                    {
                        if (line == m_util.closeBrace)
                        {
                            m_parseState.LeaveArrayLevel();
                            if (m_parseState.SymbolStart)
                            {
                                if (m_parseState.StateEnteredLevel[(int)PayReadState.SYMBOLSTART] == m_parseState.ArrayDepth)
                                {
                                    m_parseState.LeaveSymbols();
                                }
                            }
                            break;
                        }

                        // could be end of a reelstop definition, or moving up a level
                        if (line == m_util.arrayEnd)
                        {
                            m_parseState.LeaveArrayLevel();
                            if (m_parseState.SymbolStart)
                            {
                                if (m_parseState.StateEnteredLevel[(int)PayReadState.SYMBOLSTART] == m_parseState.ArrayDepth)
                                {
                                    m_parseState.LeaveSymbols();
                                }
                            }
                            break;
                        }
                    }

                    if (m_parseState.SymbolStart)
                    {
                        symbol = line.Replace(m_util.openBrace, "");
                        symbol = symbol.Replace(m_util.closeBrace, "");
                        parts  = symbol.Split(m_util.comma);
                        m_symbolList.Add(parts[0]);
                    }
                    else
                    {
                        m_parseState.ResetSymbols();
                        break;
                    }
                }
            }
        }