static void Main() { String logfile = Program.ExecutablePath() + "\\" + Program.AppName() + ".log"; FileStreamWithBackup fs = new FileStreamWithBackup(logfile, _MAXLOGFILESIZE, 10, FileMode.Append); fs.CanSplitData = false; TextWriterTraceListenerWithTime listener = new TextWriterTraceListenerWithTime(fs); Trace.Listeners.Add(listener); Trace.AutoFlush = true; Trace.WriteLine(String.Format("JPG Corruptor V{0} - Started", Application.ProductVersion), "START"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new JPGCorruptForm()); Trace.WriteLine("Stopped {0}", "STOPPED"); Trace.Flush(); listener.Close(); }