you can use regular expression for this.
try following
using System.IO;
using System.Text.RegularExpressions;
private void ProcessSubTitleFile(string pathToFile)
{
Regex regex = new Regex(@"(?<num>\d+)\r\n(?<starttime>(\d\d:){2}\d\d,\d{3})\s-->\s(?<endtime>(\d\d:){2}\d\d,\d{3})\r\n(?<translationtext>(.|[\r\n])+?(?=\r\n\r\n|$))");
var textOfFile =File.ReadAllText(pathToFile);
var matches = regex.Matches(textOfFile);
var splits = regex.Split(textOfFile);
foreach (Match match in matches)
{
var num = match.Groups["num"].Value;
var starttime = match.Groups["starttime"].Value;
var endtime = match.Groups["endtime"].Value;
var translationtext = match.Groups["translationtext"].Value;
}
}
or you can get the anonymous list
private void ProcessSubTitleFile(string pathToFile)
{
Regex regex = new Regex(@"(?<num>\d+)\r\n(?<starttime>(\d\d:){2}\d\d,\d{3})\s-->\s(?<endtime>(\d\d:){2}\d\d,\d{3})\r\n(?<translationtext>(.|[\r\n])+?(?=\r\n\r\n|$))");
var textOfFile =File.ReadAllText(pathToFile);
var matches = regex.Matches(textOfFile);
var splits = regex.Split(textOfFile);
var items = (from System.Text.RegularExpressions.Match match in matches
select new
{
num = match.Groups["num"].Value,
starttime = match.Groups["starttime"].Value,
endtime = match.Groups["endtime"].Value,
translationtext = match.Groups["translationtext"].Value
}).ToList();
}