Нет описания

Program.cs 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Serilog;
  2. using System;
  3. using System.IO;
  4. using System.Windows.Forms;
  5. namespace BulkPrinting
  6. {
  7. static class Program
  8. {
  9. /// <summary>
  10. /// The main entry point for the application.
  11. /// </summary>
  12. [STAThread]
  13. static void Main()
  14. {
  15. Globals.MaxDBPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Configuration.MaxDataPathName);
  16. Globals.MaxDBFilePath = Path.Combine(Globals.MaxDBPath, Configuration.MaxDBFileName);
  17. Log.Logger = new LoggerConfiguration()
  18. .MinimumLevel.Debug()
  19. .WriteTo.Debug()
  20. .WriteTo.File(
  21. Path.Combine(Globals.MaxDBPath, "application.log"),
  22. rollOnFileSizeLimit: true,
  23. fileSizeLimitBytes: 1024 * 1024,
  24. retainedFileCountLimit: 10,
  25. restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Information)
  26. .CreateLogger();
  27. Log.Information("Version {0} starting", Application.ProductVersion);
  28. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
  29. #if SIMULATE_HDD_SERIAL
  30. //Globals.HDDSerialNumber = "9VMTDFGX";
  31. Globals.HDDSerialNumber = "2ZRA6NXL";
  32. #else
  33. Globals.HDDSerialNumber = Utility.GetHDDSerial();
  34. #endif
  35. Application.EnableVisualStyles();
  36. Application.SetCompatibleTextRenderingDefault(false);
  37. Application.Run(new UserLoginForm());
  38. Log.Information("Version {0} exiting", Application.ProductVersion);
  39. }
  40. private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
  41. {
  42. Log.Fatal((Exception)e.ExceptionObject, "Unhandled exception");
  43. }
  44. }
  45. }