public JPGCorruptForm() { InitializeComponent(); this.DoubleBuffered = true; this.Invalidate(); _settingsFileName = Program.ExecutablePath() + "\\" + Program.AppName() + ".settings"; toolStripLabelCurrent.Text = ""; // Retrieve settings try { _settings = Settings.DeserializeFromXML(_settingsFileName); } catch (Exception ex) { Trace.WriteLine("Failure reading settings file: " + ex.ToString(), "ERROR"); MessageBox.Show("Failure reading settings file: " + ex.Message); } Loop = _settings.Loop; Trace.WriteLine(String.Format("Loop = {0}", Loop.ToString())); try { // These two properties actually try to load the file data Trace.WriteLine(String.Format("Trying _settings.TextFile: {0}", _settings.TextFile)); CurrentTextFile = _settings.TextFile; Trace.WriteLine(String.Format("Trying _settings.ImageFile: {0}", _settings.ImageFile)); CurrentImageFile = _settings.ImageFile; } catch (FileNotFoundException) { Trace.WriteLine("File not found. Ignoring exception"); // Ignore if the files aren't found during app load. } if (_settings.AutoStart) { FullScreen = _settings.FullScreen; Trace.WriteLine(String.Format("FullScreen = {0}", FullScreen.ToString())); Go(); } }
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(); }