public Subtitle GetSubtitleByFile(string file, Types.SubtitleFormat format) { List <Dialog> dialogs = new List <Dialog>(); SubtitleReader reader = null; switch (format) { case Types.SubtitleFormat.ASS: reader = new AssSubtitleReader(); break; case Types.SubtitleFormat.SRT: reader = new SrtSubtitleReader(); break; case Types.SubtitleFormat.VTT: reader = new VttSubtitleReader(); break; } if (reader != null) { string[] contentLines = new StorageAccess.ReadFile().GetLines(file); reader.Load(contentLines); dialogs.AddRange(reader.GetDialogs()); } return(new Subtitle(file, dialogs)); }
public List <Subtitle> GetSubtitlesByReadFormat() { SubtitleReader reader = null; string[] files = null; switch (ReadFormat) { case Types.SubtitleFormat.ASS: reader = new AssSubtitleReader(); files = storage.GetAllAssFiles(); break; case Types.SubtitleFormat.SRT: reader = new SrtSubtitleReader(); files = storage.GetAllSrtFiles(); break; case Types.SubtitleFormat.VTT: reader = new VttSubtitleReader(); files = storage.GetAllVttFiles(); break; } if (reader == null) { return(new List <Subtitle>()); } return(GetSubtitles(reader, files)); }