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); }