static void Main(string[] args) { var config = Config.GetInstance(); if (config.LoggerType != null) { Logger = GetLogger(config); } else { Logger = new XmlTvGenerator.Logger.DummyLogger(); } Logger.WriteEntry("Grabbing started", LogType.Info); try { List <Show> shows = GetShows(Logger); if (shows.Count == 0) { Console.WriteLine("No shows found."); } else { var xmltv = new XmlTv(); if (File.Exists(config.OutputPath)) { File.Delete(config.OutputPath); } using (var f = new FileStream(config.OutputPath, FileMode.CreateNew)) xmltv.Save(shows, f); } Logger.WriteEntry("Grabbing finished", LogType.Info); } catch (Exception e) { Logger.WriteEntry(e.Message, LogType.Error); } }
static void Main(string[] args) { var config = Config.GetInstance(); if (config.LoggerType != null) Logger = GetLogger(config); else Logger = new XmlTvGenerator.Logger.DummyLogger(); Logger.WriteEntry("Grabbing started", LogType.Info); try { List<Show> shows = GetShows(Logger); if (shows.Count == 0) Console.WriteLine("No shows found."); else { var xmltv = new XmlTv(); if (File.Exists(config.OutputPath)) File.Delete(config.OutputPath); using (var f = new FileStream(config.OutputPath, FileMode.CreateNew)) xmltv.Save(shows, f); } Logger.WriteEntry("Grabbing finished", LogType.Info); } catch (Exception e) { Logger.WriteEntry(e.Message, LogType.Error); } }