コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: hagaygo/XmlTvGenerator
 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);
     }
 }