public ErrorCollection Write()
{
if (this.IsValid())
{
try
{
this.Delete();
foreach (BluRayDiscInfo disc in _bluRayDiscInfoList.Where(d => d.IsSelected))
{
foreach (BluRaySummaryInfo summary in disc.BluRaySummaryInfoList.Where(s => s.IsSelected).OrderBy(s => s.EpisodeNumber))
{
IFFMSIndexOutputService ffmsIndexOutputService = new FFMSIndexOutputService(_eac3toConfiguration, _eac3ToOutputNamingService, disc.BluRayPath, summary);
string ffmsIndexPart = ffmsIndexOutputService.GetFFMSIndexPathPart();
string videoStreamPart = ffmsIndexOutputService.GetVideoStreamPart();
using (StreamWriter sw = new StreamWriter(_eac3toConfiguration.FFMSIndextBatchFilePath, true))
{
sw.WriteLine(string.Format("{0} {1}",ffmsIndexPart, videoStreamPart));
sw.WriteLine();
sw.WriteLine();
}
}
}
}
catch (Exception ex)
{
_log.ErrorFormat(Program.GetLogErrorFormat(), ex.Message, ex.StackTrace, MethodBase.GetCurrentMethod().Name);
_errors.Add(new Error() { Description = "There was an error while creating the ffmsindex batch file." });
}
}
return _errors;
}