/[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 39 by william, Fri Mar 8 02:13:59 2013 UTC revision 40 by william, Fri Mar 8 02:40:55 2013 UTC
# Line 11  using Enterprise.Logging; Line 11  using Enterprise.Logging;
11  using libxmltv.Interfaces;  using libxmltv.Interfaces;
12  using System.IO;  using System.IO;
13  using System.Runtime.Serialization.Formatters.Binary;  using System.Runtime.Serialization.Formatters.Binary;
14    using System.Threading;
15    
16  namespace xmltv_parser  namespace xmltv_parser
17  {  {
# Line 21  namespace xmltv_parser Line 22  namespace xmltv_parser
22              InitializeComponent();              InitializeComponent();
23              string log_path = Application.StartupPath;              string log_path = Application.StartupPath;
24              string log_filename = string.Format("{0}.log", typeof(main).Assembly.GetName().Name);              string log_filename = string.Format("{0}.log", typeof(main).Assembly.GetName().Name);
25              gLog.CreateLog(string.Format(@"{0}\{1}", log_path, log_filename), false, LogLevel.kLogLevel_All);              gLog.CreateLog(string.Format(@"{0}\{1}", log_path, log_filename), false, LogLevel.kLogLevel_All, new EventHandler<LoggerOnFlushEventArgs>(Logger_OnFlush));
26            }
27    
28            StringBuilder log_flusher = new StringBuilder();
29            void Logger_OnFlush(object sender, LoggerOnFlushEventArgs e)
30            {
31                //Console.Write(e.Buffer);        
32                log_flusher.Append(e.Buffer);
33                if(e.Buffer == System.Environment.NewLine[0])
34                {
35                    OnLogFlush(log_flusher.ToString().TrimEnd(new char[] { System.Environment.NewLine[0] }).TrimStart(new char[]{'\n'}));
36                    log_flusher = new StringBuilder();
37                }
38            }
39    
40            void OnLogFlush(string logmessage)
41            {
42                txtStatus.Text = logmessage;
43                Thread.Sleep(100);
44          }          }
45    
46          //List<IXMLTVChannel> Channels;          //List<IXMLTVChannel> Channels;

Legend:
Removed from v.39  
changed lines
  Added in v.40

  ViewVC Help
Powered by ViewVC 1.1.22