The WriteStream in the SrtWriter method might called multiple times. I think the TextWriter writer should not be closed early in this method.
|
public void WriteStream(Stream stream, IEnumerable<SubtitleItem> subtitleItems, bool includeFormatting = true) |
|
{ |
|
using TextWriter writer = new StreamWriter(stream); |
|
|
|
List<SubtitleItem> items = subtitleItems.ToList(); // avoid multiple enumeration since we're using a for instead of foreach |
|
for (int i = 0; i < items.Count; i++) |
|
{ |
|
SubtitleItem subtitleItem = items[i]; |
|
IEnumerable<string> lines = SubtitleItemToSubtitleEntry(subtitleItem, i + 1, includeFormatting); // add one because subtitle entry numbers start at 1 instead of 0 |
|
foreach (string line in lines) |
|
writer.WriteLine(line); |
|
|
|
writer.WriteLine(); // empty line between subtitle entries |
|
} |
|
} |
The
WriteStreamin theSrtWritermethod might called multiple times. I think theTextWriter writershould not be closed early in this method.SubtitlesParser/SubtitlesParser/Classes/Writers/SrtWriter.cs
Lines 58 to 72 in 19ab8d3