public App() { try { var arguments = Environment.GetCommandLineArgs(); AppArguments.Instance.AppName = "MicSwitch"; if (!AppArguments.Parse(arguments)) { SharedLog.Instance.InitializeLogging("Startup", AppArguments.Instance.AppName); throw new ApplicationException($"Failed to parse command line args: {string.Join(" ", arguments)}"); } InitializeContainer(); InitializeLogging(); Log.Debug($"Arguments: {arguments.DumpToText()}"); Log.Debug($"ProcessID: {Process.GetCurrentProcess().Id}"); Log.Debug($"Parsed args: {AppArguments.Instance}"); 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; } }
private static void Execute(string[] args) { NameValueCollection settings = args.ToNameValueCollection(); AppArguments arguments = AppArguments.Parse(settings); Context context = new Context(arguments, Cancellation.Token, Console.Out); AppHost host = new AppHost(context, new RequestSenderCreator()); host.Run(); }
public void Should_Return_Default_Values() { // Act AppArguments result = AppArguments.Parse(_mandatoryArguments); // Assert Assert.That(result.Loop, Is.EqualTo(1)); Assert.That(result.Method, Is.EqualTo(HttpMethod.Get)); Assert.That(result.Port, Is.EqualTo(80)); Assert.That(result.Srv, Is.EqualTo("localhost")); Assert.That(result.Status, Is.EqualTo(200)); Assert.That(result.Threads, Is.EqualTo(1)); Assert.That(result.Uri, Is.EqualTo("/")); }
public void GetUrl_Should_Return_Absolute_Url() { // Arrange NameValueCollection rawArguments = new NameValueCollection { {"-srv", "test.test"}, {"-port", "8080"}, {"-uri", "api/users"} }; AppArguments arguments = AppArguments.Parse(rawArguments); // Act string result = arguments.GetUrl(); // Assert Assert.That(result, Is.EqualTo("http://test.test:8080/api/users")); }
public App() { try { var arguments = Environment.GetCommandLineArgs(); AppArguments.Instance.AppName = "EyeAuras"; if (!AppArguments.Parse(arguments)) { SharedLog.Instance.InitializeLogging("Startup", AppArguments.Instance.AppName); throw new ApplicationException($"Failed to parse command line args: {string.Join(" ", arguments)}"); } InitializeLogging(); Log.Debug($"Arguments: {arguments.DumpToText()}"); Log.Debug($"Parsed args: {AppArguments.Instance.DumpToText()}"); Log.Debug($"OS Version: {Environment.OSVersion}, is64bit: {Environment.Is64BitProcess} (OS: {Environment.Is64BitOperatingSystem})"); Log.Debug($"Is Elevated: {AppArguments.Instance.IsElevated}"); Log.Debug($"Culture: {Thread.CurrentThread.CurrentCulture}, UICulture: {Thread.CurrentThread.CurrentUICulture}"); Log.Debug($"UI Scheduler: {RxApp.MainThreadScheduler}"); RxApp.MainThreadScheduler = DispatcherScheduler.Current; RxApp.TaskpoolScheduler = TaskPoolScheduler.Default; Current.ShutdownMode = ShutdownMode.OnMainWindowClose; Log.Debug($"New UI Scheduler: {RxApp.MainThreadScheduler}"); Log.Debug($"Configuring AllowSetForegroundWindow permissions"); UnsafeNative.AllowSetForegroundWindow(); aurasBootstrapper = new EyeAurasBootstrapper(); Disposable.Create( () => { Log.Info("Disposing bootstrapper..."); aurasBootstrapper.Dispose(); }) .AddTo(anchors); } catch (Exception ex) { Log.HandleException(ex); throw; } }