static void Main(string[] args) { Theme.LoadFonts(); CreateDirectories(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #if THEMEDEBUGGER TryEnableDpiAware(); Application.Run(new ThemeShowcase()); return; #endif #if WINDOWSNOTIFICATION var stuff = new ToastContentBuilder() .AddText("Shotr") .AddText("Image Saved to Clipboard!") .AddAppLogoOverride(new Uri(@"C:\Users\zac\Desktop\New Color Logos\Shotr App Icon - full square new color.png"), ToastGenericAppLogoCrop.Circle) .AddHeroImage(new Uri(@"C:\Users\Zac\Downloads\_images_2021_02_01_20_gVph8F.mp4.thumbnail.png")) .GetToastContent(); var things = stuff.GetContent(); XmlDocument x = new XmlDocument(); x.LoadXml(things); ToastNotification toast = new ToastNotification(x); ToastNotificationManager.CreateToastNotifier("Shotr").Show(toast); Thread.Sleep(10000); return; #endif if (args.Length > 0) { foreach (var arg in args) { switch (arg) { case "--debug": _debug = true; break; case "--region": case "--record": PipeClient.SendCommand(args[0]); Environment.Exit(0); break; } } } if (_debug) { if (!WinApi.AttachConsole(-1)) { WinApi.AllocConsole(); } } Console.SetOut(new ConsoleWriter(_debug)); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; _mutex = new Mutex(true, "ShotrMutexHotKeyHook", out var mutex); if (!mutex) { PipeClient.SendCommand("--launch"); Environment.Exit(0); return; } Console.WriteLine($"Starting Shotr v{Assembly.GetExecutingAssembly().GetName().Version}..."); var services = new ServiceCollection(); ConfigureServices(services); ServiceProvider = services.BuildServiceProvider(); ConfigureApplication(); TryEnableDpiAware(); var form = ServiceProvider.GetService <MainForm>(); var settings = ServiceProvider.GetService <BaseSettings>(); var hotkeys = ServiceProvider.GetService <HotKeyService>(); var shotrApi = ServiceProvider.GetService <ShotrApiService>(); hotkeys.LoadHotKeys(); form.SetUpForm(!settings.StartMinimized, !settings.StartMinimized); #if TESTING #else Updater.BaseSettings = settings; Updater.OnUpdateCheck += Updater_OnUpdateCheck; Updater.CheckForUpdates(); #endif // Do not require mandatory login if (settings.Login.Enabled == true) { try { var check = Task.Run(async() => await shotrApi.Login()).Result; if (check is { }) { settings.Login.Email = check.Email; settings.Login.Token = check.Token; settings.Uploads = check.Uploads; } else { var loginForm = new LoginForm(settings, shotrApi); if (loginForm.ShowDialog() != DialogResult.OK) { settings.Login.Enabled = false; settings.Login.Token = null; settings.Login.Email = null; } } }