static void Main() { FileLogDestination fileLogger = null; try { fileLogger = new FileLogDestination("persistentclipboard.log"); Logger = new SimpleLogger.SimpleLogger(true, Status.Error, new ILogDestination[] { fileLogger }); Application.ThreadException += new ThreadExceptionHandler().ApplicationThreadException; try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); } catch (Exception e) { Logger.Error("App startup", e); // Probably want something a little more sophisticated than this MessageBox.Show(e.Message, "The application could not initialize.", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } Application.Run(new HostForm(Logger)); } finally { if (fileLogger != null) fileLogger.Dispose(); } }
static void Main(string[] args) { try { if (args.Length == 0) { WriteInfoMessage(); return; } var logLevel = args.Any(a => a == "-v") ? SimpleLogLevel.Verbose : SimpleLogLevel.Error; Log = new SimpleLogger(logLevel); var fileToAdd = Path.GetFullPath(args[0]); var projectFileIncluder = new ProjectFileIncluder {Log = Log}; projectFileIncluder.IncludeFile(fileToAdd); } catch (Exception e) { Log.Error("Fatal error: {0}\n{1}", e.Message, e.StackTrace); } }