public override void Parse(System.IO.StreamReader inStream, string line, ParserState parseState) { bool reelEndFound = false; String[] parsedRow; do { line = line.Trim(); if (line.Length == 0) continue; if (line.Contains("/")) { int pos = line.IndexOf("/"); line = line.Remove(pos); } if (line == m_utils.closeBrace || line == m_utils.arrayEnd) reelEndFound = true; if (reelEndFound) { parseState.LeaveArrayLevel(); if (parseState.ReelStart) parseState.LeaveBaseReel(); if (parseState.FreeStart) parseState.LeaveFreeReel(); if (parseState.ModifierStart) parseState.LeaveModifierReel(); return; } if (!line.StartsWith(m_utils.openBrace)) continue; // parse the line line = line.Replace("{", ""); // kill open braces line = line.Replace(" ", ""); // kill extra spaces line = line.Replace(",", " "); // kill commas parsedRow = line.Split(m_utils.cBrace, StringSplitOptions.RemoveEmptyEntries); // now we can split into space-separated tuples cleanStringArray(parsedRow); for (int i = 0; i < parsedRow.Length; i++) { if (parsedRow[i] == "") continue; String[] parsedCell = parsedRow[i].Split(' '); if (parsedCell.Length != 3) continue; BallyReelStop stop = new BallyReelStop(); stop.Parse(parsedRow[i]); if (stop.IsValid) Add(stop); } } while ((line = inStream.ReadLine()) != null); if (parseState.ReelStart) parseState.LeaveBaseReel(); if (parseState.FreeStart) parseState.LeaveFreeReel(); if (parseState.ModifierStart) parseState.LeaveModifierReel(); }
public override void Parse(System.IO.StreamReader inStream, string line, ParserState parseState) { bool reelEndFound = false; String[] parsedRow; do { line = line.Trim(); if (line.Length == 0) { continue; } if (line.Contains("/")) { int pos = line.IndexOf("/"); line = line.Remove(pos); } if (line == m_utils.closeBrace || line == m_utils.arrayEnd) { reelEndFound = true; } if (reelEndFound) { parseState.LeaveArrayLevel(); if (parseState.ReelStart) { parseState.LeaveBaseReel(); } if (parseState.FreeStart) { parseState.LeaveFreeReel(); } if (parseState.ModifierStart) { parseState.LeaveModifierReel(); } return; } if (!line.StartsWith(m_utils.openBrace)) { continue; } // parse the line line = line.Replace("{", ""); // kill open braces line = line.Replace(" ", ""); // kill extra spaces line = line.Replace(",", " "); // kill commas parsedRow = line.Split(m_utils.cBrace, StringSplitOptions.RemoveEmptyEntries); // now we can split into space-separated tuples cleanStringArray(parsedRow); for (int i = 0; i < parsedRow.Length; i++) { if (parsedRow[i] == "") { continue; } String[] parsedCell = parsedRow[i].Split(' '); if (parsedCell.Length != 3) { continue; } BallyReelStop stop = new BallyReelStop(); stop.Parse(parsedRow[i]); if (stop.IsValid) { Add(stop); } } } while ((line = inStream.ReadLine()) != null); if (parseState.ReelStart) { parseState.LeaveBaseReel(); } if (parseState.FreeStart) { parseState.LeaveFreeReel(); } if (parseState.ModifierStart) { parseState.LeaveModifierReel(); } }
public void Add(BallyReelStop stop) { m_reelStops.Add(stop); }