static App() { Logfile = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ESME Workbench"), "transmission_loss_viewer.log"); if (File.Exists(Logfile)) File.Delete(Logfile); Trace.Listeners.Add(new TextWriterTraceListener(Logfile, "logfile") { TraceOutputOptions = TraceOptions.None }); Trace.AutoFlush = true; Trace.WriteLine(Name + " initializing"); if (OSInfo.OperatingSystemName != "XP") { DumpFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "transmission_loss_viewer_crash.mdmp"); AppDomain.CurrentDomain.UnhandledException += LastChanceExceptionHandler; } Log = new AppEventLog(Name); Log.Debug(EventLogEntryType.Information, "Starting"); }
static App() { ApplicationDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Name); if (!Directory.Exists(ApplicationDirectory)) Directory.CreateDirectory(ApplicationDirectory); Logfile = Path.Combine(ApplicationDirectory, "app.log"); if (File.Exists(Logfile)) File.Delete(Logfile); Trace.Listeners.Add(new TextWriterTraceListener(Logfile, "logfile") { TraceOutputOptions = TraceOptions.None }); Trace.AutoFlush = true; Trace.WriteLine(Name + " initializing"); if (OSInfo.OperatingSystemName != "XP") { DumpFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "esme_workbench_crash.mdmp"); AppDomain.CurrentDomain.UnhandledException += LastChanceExceptionHandler; } #if DEBUG Log = new AppEventLog(Name); Log.Debug(EventLogEntryType.Information, "Starting"); #endif }