/[xmltv_parser]/trunk/xmltv_parser/main.cs
ViewVC logotype

Diff of /trunk/xmltv_parser/main.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 63 by william, Fri Mar 8 14:26:48 2013 UTC revision 73 by william, Sat Mar 9 10:27:39 2013 UTC
# Line 1  Line 1 
1  ´╗┐using System;  ´╗┐//#define DISABLE_RELEASE_MODE_KLOGLEVEL_DEBUG // when defined will turn off kLogLevel_Debug messages, in release mode
2    //#define DISABLE_DEBUG_MODE_KLOGLEVEL_VERBOSE_DEBUG // when defined will turn off kLogLevel_VerboseDebug message, in debug mode
3    using System;
4  using System.Collections.Generic;  using System.Collections.Generic;
5  using System.ComponentModel;  using System.ComponentModel;
6  using System.Data;  using System.Data;
# Line 18  namespace xmltv_parser Line 20  namespace xmltv_parser
20    
21      public partial class main : Form      public partial class main : Form
22      {      {
         //bool form_closing = false;  
         //private IXMLTVRuntimeInstance xmltv;  
         private bool IsUnix  
         {  
             get { return System.Environment.OSVersion.Platform == PlatformID.Unix; }  
         }  
   
23          public main()          public main()
24          {          {
25              InitializeComponent();              InitializeComponent();
# Line 33  namespace xmltv_parser Line 28  namespace xmltv_parser
28              string log_path = Application.StartupPath;              string log_path = Application.StartupPath;
29              string log_filename = string.Format("{0}.log", typeof(main).Assembly.GetName().Name);              string log_filename = string.Format("{0}.log", typeof(main).Assembly.GetName().Name);
30              gLog.CreateLog(string.Format(@"{0}\{1}", log_path, log_filename), false, LogLevel.kLogLevel_All_NoProgress, new EventHandler<LoggerOnFlushEventArgs>(Log_OnFlush));              gLog.CreateLog(string.Format(@"{0}\{1}", log_path, log_filename), false, LogLevel.kLogLevel_All_NoProgress, new EventHandler<LoggerOnFlushEventArgs>(Log_OnFlush));
31              gLog.SetLogLevel(gLog.LogLevel & ~LogLevel.kLogLevel_VerboseDebug);  #if DEBUG
32                LogLevel gLevel = gLog.LogLevel;
33    #if DISABLE_DEBUG_MODE_KLOGLEVEL_VERBOSE_DEBUG
34                gLevel &= ~LogLevel.kLogLevel_VerboseDebug;
35    #else
36                gLevel |= LogLevel.kLogLevel_VerboseDebug;
37    #endif
38                gLevel |= LogLevel.kLogLevel_Debug;
39                gLog.SetLogLevel(gLevel);
40    #else
41                LogLevel gLevel = LogLevel.kLogLevel_Default; // set the default log level: Info, Warn, Error, Debug
42                // it is OK for kLogLevel_Debug to be set in Release mode ... must of the chatty messages are from kLogLevel_VerboseDebug
43    #if DISABLE_RELEASE_MODE_KLOGLEVEL_DEBUG
44                gLevel &= ~LogLevel.kLogLevel_Debug;
45    #else
46                gLevel |= LogLevel.kLogLevel_Debug;
47    #endif
48                gLevel &= ~LogLevel.kLogLevel_VerboseDebug; // ensure this is not set, ever in release mode        
49                gLog.SetLogLevel(gLevel);
50    #endif
51    
52    
53              gLog.ReportProgressEvent += new EventHandler<ReportProgressEventArgs>(gLog_ReportProgress);              gLog.ReportProgressEvent += new EventHandler<ReportProgressEventArgs>(gLog_ReportProgress);
54          }          }
55    
# Line 78  namespace xmltv_parser Line 94  namespace xmltv_parser
94    
95          void UpdateStatus(string logmessage)          void UpdateStatus(string logmessage)
96          {          {
97                if (this.InvokeRequired)
98                {
99                    try
100                    {
101                        this.Invoke((Action)(delegate { UpdateStatus(logmessage); }));
102                    }
103                    catch { }
104                    return;
105                }
106              txtStatus.Text = logmessage.Replace(System.Environment.NewLine, "");              txtStatus.Text = logmessage.Replace(System.Environment.NewLine, "");
107          }          }
108          void UpdateLogOutput(string logmessage)          void UpdateLogOutput(string logmessage)
109          {          {
110              if (txtLog.InvokeRequired)              if (this.InvokeRequired)
111              {              {
112                  try                  try
113                  {                  {
114                      txtLog.Invoke((Action)(delegate { UpdateLogOutput(logmessage); }));                      this.Invoke((Action)(delegate { UpdateLogOutput(logmessage); }));
115                  }                  }
116                  catch { }                  catch { }
117                  return;                  return;
# Line 112  namespace xmltv_parser Line 137  namespace xmltv_parser
137          void LoadXMLTVShcedule(string schedule_xml)          void LoadXMLTVShcedule(string schedule_xml)
138          {          {
139              //XMLTV.CreateInstance(schedule_xml, new EventHandler<CancelEventArgs>(xmltv_cancelevent));              //XMLTV.CreateInstance(schedule_xml, new EventHandler<CancelEventArgs>(xmltv_cancelevent));
140              XMLTV.CreateInstance(schedule_xml);              XMLTV.CreateInstance(schedule_xml, new EventHandler<EventArgs>(XMLTV_OnInstanceCreated));
141              XMLTV.OnInstanceCreated += new EventHandler<EventArgs>(XMLTV_OnInstanceCreated);              //XMLTV.OnInstanceCreated += new EventHandler<EventArgs>(XMLTV_OnInstanceCreated);
142          }          }
143    
144          void XMLTV_OnInstanceCreated(object sender, EventArgs e)          void XMLTV_OnInstanceCreated(object sender, EventArgs e)
# Line 122  namespace xmltv_parser Line 147  namespace xmltv_parser
147              var instance = XMLTV.GetInstance();              var instance = XMLTV.GetInstance();
148              if (instance != null)              if (instance != null)
149              {              {
150                  var program_count = instance.Programs.Values.Count;                  var program_count = instance.Programs.Count;
151                  var program_list = instance.Programs.Values.ToList().OrderBy(s => s.Start);                  var program_list = instance.Programs.ToList().OrderBy(s => s.Start);
152                  //Programs = program_list(0, program_count).ToList();                  //Programs = program_list(0, program_count).ToList();
153                  Programs = new List<IXMLTVProgram>(program_list.ToArray());                  Programs = new List<IXMLTVProgram>(program_list.ToArray());
154              }              }

Legend:
Removed from v.63  
changed lines
  Added in v.73

  ViewVC Help
Powered by ViewVC 1.1.22