protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); SetupLoggingConfig(); var args = e.Args; // needs to be the first call in the program to prevent weird bugs if (Settings.PersistentSettings.debugConsole) { AllocConsole(); } var uriStart = IPCAdapter.getInstance().HandleURIStart(e.Args); switch (uriStart) { case URIStartResult.CLOSE: Environment.Exit(0); break; case URIStartResult.PARSE: Console.WriteLine($"Starting with args : {e.Args[0]}"); break; case URIStartResult.CONTINUE: break; default: throw new ArgumentOutOfRangeException(); } Console.WriteLine(string.Join(", ", Assembly.GetExecutingAssembly().GetManifestResourceNames())); //Gets all the embedded resources try { config = new ConfigurationBuilder <IAppSettings>() .UseJsonFile(Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "\\AmongUsCapture\\AmongUsGUI", "Settings.json")).Build(); } catch (JsonReaderException) //Delete file and recreate config { Console.WriteLine("Bad config. Clearing."); File.Delete(Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "\\AmongUsCapture\\AmongUsGUI", "Settings.json")); config = new ConfigurationBuilder <IAppSettings>() .UseJsonFile(Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "\\AmongUsCapture\\AmongUsGUI", "Settings.json")).Build(); } var r = new Random(); var rValue = r.Next(101); var goingToPop = rValue == 1; var goingToDouche = rValue == 2; var goingToMonke = rValue == 3; if (!config.startupMemes || (!goingToPop && !goingToDouche && !goingToMonke)) { if (DateTime.Now.Month == 12) { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenChristmas.png").Show(true); } else { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenNormal.png").Show(true); } //Console.WriteLine(string.Join(", ",Assembly.GetExecutingAssembly().GetManifestResourceNames())); //Gets all the embedded resources } else if (goingToPop) { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenPop.png").Show(true); PlaySound("https://cdn.automute.us/Eggs/popcat.wav"); } else if (goingToDouche) { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenDouche.png").Show(true); PlaySound("https://cdn.automute.us/Eggs/douchebag.wav"); } else { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenMonke.png").Show(true); PlaySound("https://cdn.automute.us/Eggs/stinky.wav"); } var mainWindow = new MainWindow(); this.MainWindow = mainWindow; IPCAdapter.getInstance().OnToken += OnTokenHandler; socket.Init(); IPCAdapter.getInstance().RegisterMinion(); mainWindow.Loaded += (sender, args2) => { Task.Factory.StartNew(() => GameMemReader.getInstance().RunLoop()); // run loop in background if (uriStart == URIStartResult.PARSE) { IPCAdapter.getInstance().SendToken(args[0]); } }; mainWindow.Closing += (sender, args2) => { Environment.Exit(0); }; mainWindow.Show(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var args = e.Args; ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncAll; ThemeManager.Current.SyncTheme(); // needs to be the first call in the program to prevent weird bugs if (Settings.PersistentSettings.debugConsole) { AllocConsole(); } var uriStart = IPCAdapter.getInstance().HandleURIStart(e.Args); switch (uriStart) { case URIStartResult.CLOSE: Environment.Exit(0); break; case URIStartResult.PARSE: Console.WriteLine($"Starting with args : {e.Args[0]}"); break; case URIStartResult.CONTINUE: break; default: throw new ArgumentOutOfRangeException(); } var splashScreen = new SplashScreenWindow(); this.MainWindow = splashScreen; splashScreen.Show(); Task.Factory.StartNew(() => { this.Dispatcher.Invoke(() => { //initialize the main window, set it as the application main window //and close the splash screen var mainWindow = new MainWindow(); this.MainWindow = mainWindow; Settings.conInterface = new WPFLogger(mainWindow); IPCAdapter.getInstance().OnToken += OnTokenHandler; var socketTask = Task.Factory.StartNew(() => socket.Init()); // run socket in background. Important to wait for init to have actually finished before continuing socketTask.Wait(); IPCAdapter.getInstance().RegisterMinion(); mainWindow.Loaded += (sender, args2) => { Task.Factory.StartNew(() => GameMemReader.getInstance().RunLoop()); // run loop in background if (uriStart == URIStartResult.PARSE) { IPCAdapter.getInstance().SendToken(args[0]); } }; mainWindow.Closing += (sender, args2) => { Environment.Exit(0); }; mainWindow.Show(); splashScreen.Close(); }); }); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var args = e.Args; ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncAll; ThemeManager.Current.SyncTheme(); // needs to be the first call in the program to prevent weird bugs if (Settings.PersistentSettings.debugConsole) { AllocConsole(); } var uriStart = IPCAdapter.getInstance().HandleURIStart(e.Args); switch (uriStart) { case URIStartResult.CLOSE: Environment.Exit(0); break; case URIStartResult.PARSE: Console.WriteLine($"Starting with args : {e.Args[0]}"); break; case URIStartResult.CONTINUE: break; default: throw new ArgumentOutOfRangeException(); } Console.WriteLine(string.Join(", ", Assembly.GetExecutingAssembly().GetManifestResourceNames())); //Gets all the embedded resources var r = new Random(); var rValue = r.Next(101); var goingToPop = rValue <= 3; var goingToDouche = rValue == 4; var goingToMonke = rValue <= 7 && rValue > 4; if (!goingToPop && !goingToDouche && !goingToMonke) { if (DateTime.Now.Month == 12) { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenChristmas.png").Show(true); } else { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenNormal.png").Show(true); } //Console.WriteLine(string.Join(", ",Assembly.GetExecutingAssembly().GetManifestResourceNames())); //Gets all the embedded resources } else if (goingToPop) { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenPop.png").Show(true); PlaySound("https://cdn.automute.us/Eggs/popcat.wav"); } else if (goingToDouche) { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenDouche.png").Show(true); PlaySound("https://cdn.automute.us/Eggs/douchebag.wav"); } else { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenMonke.png").Show(true); PlaySound("https://cdn.automute.us/Eggs/stinky.wav"); } var mainWindow = new MainWindow(); this.MainWindow = mainWindow; Settings.conInterface = new WPFLogger(mainWindow); IPCAdapter.getInstance().OnToken += OnTokenHandler; socket.Init(); IPCAdapter.getInstance().RegisterMinion(); mainWindow.Loaded += (sender, args2) => { Task.Factory.StartNew(() => GameMemReader.getInstance().RunLoop()); // run loop in background if (uriStart == URIStartResult.PARSE) { IPCAdapter.getInstance().SendToken(args[0]); } }; mainWindow.Closing += (sender, args2) => { Environment.Exit(0); }; mainWindow.Show(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var args = e.Args; ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncAll; ThemeManager.Current.SyncTheme(); // needs to be the first call in the program to prevent weird bugs if (Settings.PersistentSettings.debugConsole) { AllocConsole(); } var uriStart = IPCAdapter.getInstance().HandleURIStart(e.Args); switch (uriStart) { case URIStartResult.CLOSE: Environment.Exit(0); break; case URIStartResult.PARSE: Console.WriteLine($"Starting with args : {e.Args[0]}"); break; case URIStartResult.CONTINUE: break; default: throw new ArgumentOutOfRangeException(); } Console.WriteLine(string.Join(", ", Assembly.GetExecutingAssembly().GetManifestResourceNames())); //Gets all the embedded resources var r = new Random(); var goingToPop = r.Next(101) < 5; if (!goingToPop) { if (DateTime.Now.Month == 12) { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenChristmas.png").Show(true); } else { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenNormal.png").Show(true); } //Console.WriteLine(string.Join(", ",Assembly.GetExecutingAssembly().GetManifestResourceNames())); //Gets all the embedded resources } else { new SplashScreen(Assembly.GetExecutingAssembly(), "SplashScreens\\SplashScreenPop.png").Show(true); try { var req = System.Net.WebRequest.Create( "https://github.com/denverquane/amonguscapture/raw/master/AUCapture-WPF/SplashScreens/popcat.wav"); using (Stream stream = req.GetResponse().GetResponseStream()) { SoundPlayer myNewSound = new SoundPlayer(stream); myNewSound.Load(); myNewSound.Play(); } } catch (Exception errrr) { Console.WriteLine("Minor error"); } } var mainWindow = new MainWindow(); this.MainWindow = mainWindow; Settings.conInterface = new WPFLogger(mainWindow); IPCAdapter.getInstance().OnToken += OnTokenHandler; socket.Init(); IPCAdapter.getInstance().RegisterMinion(); mainWindow.Loaded += (sender, args2) => { Task.Factory.StartNew(() => GameMemReader.getInstance().RunLoop()); // run loop in background if (uriStart == URIStartResult.PARSE) { IPCAdapter.getInstance().SendToken(args[0]); } }; mainWindow.Closing += (sender, args2) => { Environment.Exit(0); }; mainWindow.Show(); }