public App() { try { var arguments = Environment.GetCommandLineArgs(); InitializeContainer(); appArguments = container.Resolve <IAppArguments>(); if (!appArguments.Parse(arguments)) { SharedLog.Instance.InitializeLogging("Startup", appArguments.AppName); throw new ApplicationException($"Failed to parse command line args: {string.Join(" ", arguments)}"); } if (appArguments.IsDebugMode) { container.RegisterSingleton <IConfigProvider, PoeEyeConfigProviderInMemory>(); } else { container.RegisterSingleton <IConfigProvider, ConfigProviderFromFile>(); } InitializeLogging(); Log.Debug($"Arguments: {arguments.DumpToText()}"); Log.Debug($"ProcessID: {Process.GetCurrentProcess().Id}"); Log.Debug($"Parsed args: {appArguments}"); Log.Debug($"Culture: {Thread.CurrentThread.CurrentCulture}, UICulture: {Thread.CurrentThread.CurrentUICulture}"); Log.Debug($"UI Scheduler: {RxApp.MainThreadScheduler}"); RxApp.MainThreadScheduler = container.Resolve <IScheduler>(WellKnownSchedulers.UI); RxApp.TaskpoolScheduler = TaskPoolScheduler.Default; Current.ShutdownMode = ShutdownMode.OnMainWindowClose; Log.Debug($"New UI Scheduler: {RxApp.MainThreadScheduler}"); InitializeUpdateSettings(); Log.Debug("Initializing housekeeping"); var cleanupService = container.Resolve <IFolderCleanerService>(); cleanupService.AddDirectory(new DirectoryInfo(Path.Combine(appArguments.AppDataDirectory, "logs"))).AddTo(Anchors); cleanupService.CleanupTimeout = TimeSpan.FromHours(12); cleanupService.FileTimeToLive = TimeSpan.FromDays(14); } catch (Exception ex) { Log.HandleException(ex); throw; } }
public App() { try { var arguments = Environment.GetCommandLineArgs(); InitializeContainer(); appArguments = container.Resolve <IAppArguments>(); if (!appArguments.Parse(arguments)) { SharedLog.Instance.InitializeLogging("Startup", appArguments.AppName); throw new ApplicationException($"Failed to parse command line args: {string.Join(" ", arguments)}"); } if (appArguments.IsDebugMode) { container.RegisterSingleton <IConfigProvider, PoeEyeConfigProviderInMemory>(); } else { container.RegisterSingleton <IConfigProvider, ConfigProviderFromFile>(); } InitializeLogging(); Log.Debug($"Arguments: {arguments.DumpToText()}"); Log.Debug($"ProcessID: {Process.GetCurrentProcess().Id}"); Log.Debug($"Parsed args: {appArguments}"); Log.Debug($"Culture: {Thread.CurrentThread.CurrentCulture}, UICulture: {Thread.CurrentThread.CurrentUICulture}"); Log.Debug($"UI Scheduler: {RxApp.MainThreadScheduler}"); RxApp.MainThreadScheduler = container.Resolve <IScheduler>(WellKnownSchedulers.UI); RxApp.TaskpoolScheduler = TaskPoolScheduler.Default; Current.ShutdownMode = ShutdownMode.OnMainWindowClose; Log.Debug($"New UI Scheduler: {RxApp.MainThreadScheduler}"); InitializeUpdateSettings(); } catch (Exception ex) { Log.HandleException(ex); throw; } }