-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
The WriteStream in the SrtWriter method might called multiple times. I think the TextWriter writer should not be closed early in this method.
SubtitlesParser/SubtitlesParser/Classes/Writers/SrtWriter.cs
Lines 58 to 72 in 19ab8d3
| 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 | |
| } | |
| } |
Metadata
Metadata
Assignees
Labels
No labels