public virtual void LoadTextFileBlock(StringReader blockStream)
{
if (this.patternDivide == null)
{
return;
}
StringWriter smallerBlockStream = new StringWriter();
string fileLine;
StringReader blockStreamReader;
int? lastBlock = null;
// Loop through all lines of file
while ((fileLine = blockStream.ReadLine()) != null)
{
// Dialogue Section
Match match = Regex.Match(fileLine, this.patternDivide);
if (match.Success)
{
blockStreamReader = new StringReader(smallerBlockStream.ToString());
LoadTextFileSmallerBlock(blockStreamReader, lastBlock);
smallerBlockStream = new StringWriter();
lastBlock = Int32.Parse(match.Groups[1].Value);
}
smallerBlockStream.WriteLine(fileLine);
}
// Process last block
blockStreamReader = new StringReader(smallerBlockStream.ToString());
LoadTextFileSmallerBlock(blockStreamReader, lastBlock);
}