private void update_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { _settingManager.SaveConfigFile(EnvironmentHelper.GetConfigFilePath()); _settingManager.SaveRegistry(MStrGameRegistry); if (_isStudio) { _settingManager.SaveRegistry(MStrStudioRegistry); } EnvironmentHelper.StartUpdate(); }
private void PlayFunc(string strExe) { _settingManager.SaveConfigFile(EnvironmentHelper.GetConfigFilePath()); _settingManager.SaveRegistry(MStrGameRegistry); if (_isStudio) { _settingManager.SaveRegistry(MStrStudioRegistry); } EnvironmentHelper.StartGame(strExe); }
public MainWindow() { try { _suppressEvents = true; // Initialize code ------------------------------------- EnvironmentHelper.Initialize(_builtinLanguages); _mainGameExists = File.Exists(EnvironmentHelper.GameRootDirectory + ExecutableGame); _studioExists = File.Exists(EnvironmentHelper.GameRootDirectory + ExecutableStudio); if (_studioExists) { SettingManager.Initialize(EnvironmentHelper.GetConfigFilePath(), RegistryKeyGame, RegistryKeyStudio, RegistryKeyVR); } else { SettingManager.Initialize(EnvironmentHelper.GetConfigFilePath(), RegistryKeyGame); } SettingManager.LoadSettings(); // Initialize interface -------------------------------- InitializeComponent(); var tooltip = new System.Windows.Controls.ToolTip { Content = Localizable.TooltipBoneMod }; toggleBoneMod.ToolTip = tooltip; WindowStartupLocation = WindowStartupLocation.CenterScreen; CustomRes.Visibility = Visibility.Hidden; if (string.IsNullOrEmpty((string)labelTranslated.Content)) { labelTranslated.Visibility = Visibility.Hidden; labelTranslatedBorder.Visibility = Visibility.Hidden; } if (!EnvironmentHelper.KKmanExist) { gridUpdate.Visibility = Visibility.Hidden; } // Launcher Customization: Defining Warning, background and character if (!string.IsNullOrEmpty(EnvironmentHelper.VersionString)) { labelDist.Content = EnvironmentHelper.VersionString; } if (!string.IsNullOrEmpty(EnvironmentHelper.WarningString)) { warningText.Text = EnvironmentHelper.WarningString; } if (EnvironmentHelper.CustomCharacterImage != null) { PackChara.Source = EnvironmentHelper.CustomCharacterImage; } if (EnvironmentHelper.CustomBgImage != null) { appBG.ImageSource = EnvironmentHelper.CustomBgImage; } if (string.IsNullOrEmpty(EnvironmentHelper.PatreonUrl)) { linkPatreon.Visibility = Visibility.Collapsed; patreonBorder.Visibility = Visibility.Collapsed; patreonIMG.Visibility = Visibility.Collapsed; } var primaryDisplay = Localizable.PrimaryDisplay; var subDisplay = Localizable.SubDisplay; for (var i = 0; i < Screen.AllScreens.Length; i++) { // 0 is primary var newItem = i == 0 ? primaryDisplay : $"{subDisplay} : " + i; dropDisplay.Items.Add(newItem); } PlayHomeStartup(); PluginToggleManager.CreatePluginToggles(Toggleables); _suppressEvents = false; UpdateDisplaySettings(SettingManager.CurrentSettings.FullScreen); Closed += (sender, args) => SettingManager.SaveSettings(); MouseDown += (sender, args) => { if (args.ChangedButton == MouseButton.Left) { DragMove(); } }; buttonClose.Click += (sender, args) => Close(); } catch (Exception e) { MessageBox.Show( "Failed to start the launcher, please consider reporting this error to the developers.\n\nError that caused the crash: " + e, "Launcher crash", MessageBoxButtons.OK, MessageBoxIcon.Error); File.WriteAllText(Path.Combine(EnvironmentHelper.GameRootDirectory, "launcher_crash.log"), e.ToString()); Close(); } }
public MainWindow() { InitializeComponent(); _isDuringStartup = true; _settingManager = new SettingManager(); EnvironmentHelper.Initialize(); EnvironmentHelper.CheckDuplicateStartup(); WindowStartupLocation = WindowStartupLocation.CenterScreen; CustomRes.Visibility = Visibility.Hidden; if (!EnvironmentHelper.KKmanExist) { gridUpdate.Visibility = Visibility.Hidden; } switch (EnvironmentHelper.DeveloperModeEnabled) { case null: toggleConsole.IsEnabled = false; break; case false: toggleConsole.IsChecked = false; break; case true: toggleConsole.IsChecked = true; break; } // Mod settings if (File.Exists($"{EnvironmentHelper.GameRootDirectory}\\BepInEx\\Plugins\\DHH_AI4.dll")) { toggleDHH.IsChecked = true; } if (!File.Exists($"{EnvironmentHelper.GameRootDirectory}\\BepInEx\\Plugins\\DHH_AI4.dl_") && !File.Exists($"{EnvironmentHelper.GameRootDirectory}\\BepInEx\\Plugins\\DHH_AI4.dll")) { toggleDHH.IsEnabled = false; } if (File.Exists($"{EnvironmentHelper.GameRootDirectory}\\BepInEx\\Plugins\\AIGraphics\\AI_Graphics.dll")) { toggleAIGraphics.IsChecked = true; } if (!File.Exists($"{EnvironmentHelper.GameRootDirectory}\\BepInEx\\Plugins\\AIGraphics\\AI_Graphics.dl_") && !File.Exists($"{EnvironmentHelper.GameRootDirectory}\\BepInEx\\Plugins\\AIGraphics\\AI_Graphics.dll")) { toggleAIGraphics.IsEnabled = false; } if (File.Exists($"{EnvironmentHelper.GameRootDirectory}\\BepInEx\\Plugins\\AIGraphics\\AI_Graphics.dll") && File.Exists($"{EnvironmentHelper.GameRootDirectory}\\BepInEx\\Plugins\\DHH_AI4.dll")) { toggleDHH.IsChecked = false; toggleAIGraphics.IsChecked = false; } _isDuringStartup = false; SetupUiLanguage(); // Launcher Customization: Defining Warning, background and character if (!string.IsNullOrEmpty(EnvironmentHelper.VersionString)) { labelDist.Content = EnvironmentHelper.VersionString; } _isStudio = File.Exists(EnvironmentHelper.GameRootDirectory + MStrStudioExe); _isMainGame = File.Exists(EnvironmentHelper.GameRootDirectory + MStrGameExe); if (!string.IsNullOrEmpty(EnvironmentHelper.WarningString)) { warningText.Text = EnvironmentHelper.WarningString; } if (EnvironmentHelper.CustomCharacterImage != null) { PackChara.Source = EnvironmentHelper.CustomCharacterImage; } if (EnvironmentHelper.CustomBgImage != null) { appBG.ImageSource = EnvironmentHelper.CustomBgImage; } if (string.IsNullOrEmpty(EnvironmentHelper.PatreonUrl)) { linkPatreon.Visibility = Visibility.Collapsed; patreonBorder.Visibility = Visibility.Collapsed; patreonIMG.Visibility = Visibility.Collapsed; } var num = Screen.AllScreens.Length; if (num == 2) { dropDisplay.Items.Add(_sPrimarydisplay); dropDisplay.Items.Add($"{_sSubdisplay} : 1"); } else { for (var i = 0; i < num; i++) { var newItem = i == 0 ? _sPrimarydisplay : ($"{_sSubdisplay} : " + i); dropDisplay.Items.Add(newItem); } } foreach (var newItem2 in _mAstrQuality) { dropQual.Items.Add(newItem2); } var configFilePath = EnvironmentHelper.GetConfigFilePath(); CheckConfigFile: if (File.Exists(configFilePath)) { try { _settingManager.LoadSettings(configFilePath); _settingManager.CurrentSettings.Display = Math.Min(_settingManager.CurrentSettings.Display, num - 1); SetDisplayComboBox(_settingManager.CurrentSettings.FullScreen); var flag = false; foreach (var resItem in dropRes.Items) { if (resItem.ToString() == _settingManager.CurrentSettings.Size) { flag = true; } } dropRes.Text = flag ? _settingManager.CurrentSettings.Size : "1280 x 720 (16 : 9)"; toggleFullscreen.IsChecked = _settingManager.CurrentSettings.FullScreen; dropQual.Text = _mAstrQuality[_settingManager.CurrentSettings.Quality]; var text = _settingManager.CurrentSettings.Display == 0 ? _sPrimarydisplay : $"{_sSubdisplay} : " + _settingManager.CurrentSettings.Display; if (num == 2) { text = new[] { _sPrimarydisplay, $"{_sSubdisplay} : 1" }[_settingManager.CurrentSettings.Display]; } if (dropDisplay.Items.Contains(text)) { dropDisplay.Text = text; } else { dropDisplay.Text = _sPrimarydisplay; _settingManager.CurrentSettings.Display = 0; } } catch (Exception) { MessageBox.Show("/UserData/setup.xml file was corrupted, settings will be reset."); File.Delete(configFilePath); goto CheckConfigFile; } } else { SetDisplayComboBox(false); dropRes.Text = _settingManager.CurrentSettings.Size; dropQual.Text = _mAstrQuality[_settingManager.CurrentSettings.Quality]; dropDisplay.Text = _sPrimarydisplay; } }
private void buttonClose_Click(object sender, RoutedEventArgs e) { _settingManager.SaveConfigFile(EnvironmentHelper.GetConfigFilePath()); System.Windows.Application.Current.MainWindow?.Close(); }
public MainWindow() { try { _suppressEvents = true; if (!File.Exists(EnvironmentHelper.GameRootDirectory + ExecutableGame)) { ExecutableGame = "AI-Syoujyo.exe"; } // Initialize code ------------------------------------- string tempgamedir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); bool isGameConverted = File.Exists($"{tempgamedir}/abdata/BRConvert/OK.txt"); if (isGameConverted) { RegistryKeyGame = "Software\\illusion\\AI-Syoujyo\\AI-Syoujyo\\"; RegistryKeyStudio = "Software\\illusion\\AI-Syoujyo\\StudioNEOV2"; ExecutableGame = "AI-Syoujyo.exe"; } EnvironmentHelper.Initialize(!isGameConverted ? _builtinLanguages : _builtinLanguagesConvert); _mainGameExists = File.Exists(EnvironmentHelper.GameRootDirectory + ExecutableGame); _studioExists = File.Exists(EnvironmentHelper.GameRootDirectory + ExecutableStudio); if (_studioExists) { SettingManager.Initialize(EnvironmentHelper.GetConfigFilePath(), RegistryKeyGame, RegistryKeyStudio); } else { SettingManager.Initialize(EnvironmentHelper.GetConfigFilePath(), RegistryKeyGame); } SettingManager.LoadSettings(); // Initialize interface -------------------------------- InitializeComponent(); WindowStartupLocation = WindowStartupLocation.CenterScreen; CustomRes.Visibility = Visibility.Hidden; if (string.IsNullOrEmpty((string)labelTranslated.Content)) { labelTranslated.Visibility = Visibility.Hidden; labelTranslatedBorder.Visibility = Visibility.Hidden; } if (!EnvironmentHelper.KKmanExist) { gridUpdate.Visibility = Visibility.Hidden; } /* * // Launcher Customization: Defining Warning, background and character * if (!string.IsNullOrEmpty(EnvironmentHelper.VersionString)) * labelDist.Content = EnvironmentHelper.VersionString; */ if (!string.IsNullOrEmpty(EnvironmentHelper.WarningString)) { warningText.Text = EnvironmentHelper.WarningString; } if (EnvironmentHelper.CustomCharacterImage != null) { PackChara.Source = EnvironmentHelper.CustomCharacterImage; } if (EnvironmentHelper.CustomBgImage != null) { appBG.ImageSource = EnvironmentHelper.CustomBgImage; } var primaryDisplay = Localizable.PrimaryDisplay; var subDisplay = Localizable.SubDisplay; for (var i = 0; i < Screen.AllScreens.Length; i++) { // 0 is primary var newItem = i == 0 ? primaryDisplay : $"{subDisplay} : " + i; dropDisplay.Items.Add(newItem); } PluginToggleManager.CreatePluginToggles(Toggleables); _suppressEvents = false; UpdateDisplaySettings(SettingManager.CurrentSettings.FullScreen); Closed += (sender, args) => SettingManager.SaveSettings(); MouseDown += (sender, args) => { if (args.ChangedButton == MouseButton.Left) { DragMove(); } }; buttonClose.Click += (sender, args) => Close(); } catch (Exception e) { MessageBox.Show("Failed to start the launcher, please consider reporting this error to the developers.\n\nError that caused the crash: " + e, "Launcher crash", MessageBoxButtons.OK, MessageBoxIcon.Error); File.WriteAllText(Path.Combine(EnvironmentHelper.GameRootDirectory, "launcher_crash.log"), e.ToString()); Close(); } }