public List <SubTimes> ExtractTimesToList(List <string> subtitleParts) { List <SubTimes> subTimesList = new List <SubTimes>(); for (int i = 0; i < subtitleParts.Count; i += 9) { SubTimes subTimes = new SubTimes(); subTimes.startTime = new TimeSpan(0, Convert.ToInt32(subtitleParts[i]), Convert.ToInt32(subtitleParts[i + 1]), Convert.ToInt32(subtitleParts[i + 2]), Convert.ToInt32(subtitleParts[i + 3])); subTimes.endTime = new TimeSpan(0, Convert.ToInt32(subtitleParts[i + 4]), Convert.ToInt32(subtitleParts[i + 5]), Convert.ToInt32(subtitleParts[i + 6]), Convert.ToInt32(subtitleParts[i + 7])); subTimesList.Add(subTimes); } return(subTimesList); }
public string PrintTimeStamp(SubTimes subTimes) { string timestamp = string.Empty; timestamp = subTimes.startTime.Hours.ToString("00") + ":" + subTimes.startTime.Minutes.ToString("00") + ":" + subTimes.startTime.Seconds.ToString("00") + "," + subTimes.startTime.Milliseconds.ToString("000").Substring(0, 3) + " --> " + subTimes.endTime.Hours.ToString("00") + ":" + subTimes.endTime.Minutes.ToString("00") + ":" + subTimes.endTime.Seconds.ToString("00") + "," + subTimes.endTime.Milliseconds.ToString("000").Substring(0, 3); return(timestamp); }