public void CheckServerInstallationPathTest() { // Fetching path settings Settings settings = SettingsDAL.GetSettings(); Assert.IsNotNull(settings); Assert.IsTrue(ValidationManager.CheckServerInstallationPath(settings.ServerInstallationPath)); }
public MainWindow() { InitializeComponent(); // Fetching path settings Settings = SettingsDAL.GetSettings(); managerVersionTextBlock.Text = "Version 0.5.2"; _mainFrame.Navigate(new MainPage()); }
public static async Task <bool> InstallValheimPlusUpdateAsync(bool manageClient, string valheimPlusVersion, bool freshInstall) { var settings = SettingsDAL.GetSettings(); if (manageClient) { string zipPath = @"Data/ValheimPlusGameClient/WindowsClient.zip"; string extractPath = @"Data/ValheimPlusGameClient/Extracted"; await Task.Run(() => ZipFile.ExtractToDirectory(zipPath, extractPath, true)); if (!freshInstall) { System.IO.File.Move(String.Format("{0}/BepInEx/config/valheim_plus.cfg", extractPath), String.Format("{0}/BepInEx/config/valheim_plus_latest.cfg", extractPath), true); } try { FileManager.CopyFromTo(settings.ClientPath, settings.ClientInstallationPath); settings.ValheimPlusGameClientVersion = valheimPlusVersion; SettingsDAL.UpdateSettings(settings, true); } catch (Exception) { return(false); // ToDo - handling of errors } } else { string zipPath = @"Data/ValheimPlusServerClient/WindowsServer.zip"; string extractPath = @"Data/ValheimPlusServerClient/Extracted"; await Task.Run(() => ZipFile.ExtractToDirectory(zipPath, extractPath, true)); if (!freshInstall) { System.IO.File.Move(String.Format("{0}/BepInEx/config/valheim_plus.cfg", extractPath), String.Format("{0}/BepInEx/config/valheim_plus_latest.cfg", extractPath), true); } try { FileManager.CopyFromTo(settings.ServerPath, settings.ServerInstallationPath); settings.ValheimPlusServerClientVersion = valheimPlusVersion; SettingsDAL.UpdateSettings(settings, false); } catch (Exception) { return(false); // ToDo - handling of errors } } return(true); }
public void FetchSettings() { try { // Fetching path settings Settings = SettingsDAL.GetSettings(); // Fetch current versions and update settings if needed UpdateManager.CheckCurrentVersion(Settings); // Checking paths and installation status UISettingsInit(); } catch (Exception) { statusLabel.Foreground = Brushes.Red; statusLabel.Content = "Error! Settings file not found, reinstall manager."; } }
private async void installClientButton_Click(object sender, RoutedEventArgs e) { installClientUpdateButton.IsEnabled = false; ValheimPlusUpdate valheimPlusUpdate = await UpdateManager.CheckForValheimPlusUpdatesAsync(Settings.ValheimPlusGameClientVersion); if (valheimPlusUpdate.NewVersion) { bool success = await UpdateManager.DownloadValheimPlusUpdateAsync(Settings.ValheimPlusGameClientVersion, true); if (success) { Settings = SettingsDAL.GetSettings(); statusLabel.Foreground = Brushes.Green; clientInstalledLabel.Content = String.Format("ValheimPlus {0} installed on client", Settings.ValheimPlusGameClientVersion); statusSnackBar.MessageQueue.Enqueue("Success! Game client updated to latest version"); installClientUpdateButton.IsEnabled = false; UISettingsInit(); } } }
private async void installClientButton_Click(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult; if (!ValheimPlusInstalledClient) { messageBoxResult = MessageBox.Show("Are you sure you wish to install ValheimPlus?", "Confirm", MessageBoxButton.YesNo); } else { messageBoxResult = MessageBox .Show("Are you sure you wish to reinstall ValheimPlus?", "Confirm", MessageBoxButton.YesNo); } if (messageBoxResult == MessageBoxResult.Yes) { try { bool success = await UpdateManager.DownloadValheimPlusUpdateAsync(Settings.ValheimPlusServerClientVersion, true, true); if (success) { ValheimPlusInstalledClient = ValidationManager.CheckInstallationStatus(Settings.ClientInstallationPath); if (ValheimPlusInstalledClient) { Settings = SettingsDAL.GetSettings(); statusLabel.Foreground = Brushes.Green; clientInstalledLabel.Content = String.Format("ValheimPlus {0} installed on client", Settings.ValheimPlusGameClientVersion); statusSnackBar.MessageQueue.Enqueue(String.Format("Success! ValheimPlus {0} installed on client", Settings.ValheimPlusGameClientVersion)); installClientUpdateButton.IsEnabled = false; UISettingsInit(); } } } catch (Exception) { statusSnackBar.MessageQueue.Enqueue("An error occured, report it to the devs!"); } } }
private async void installServerUpdateButton_Click(object sender, RoutedEventArgs e) { installServerUpdateButton.IsEnabled = false; installServerUpdateButton.Content = "Installing update ..."; ValheimPlusUpdate valheimPlusUpdate = await UpdateManager.CheckForValheimPlusUpdatesAsync(Settings.ValheimPlusServerClientVersion); if (valheimPlusUpdate.NewVersion) { bool success = await UpdateManager.DownloadValheimPlusUpdateAsync(Settings.ValheimPlusServerClientVersion, false, false); if (success) { Settings = SettingsDAL.GetSettings(); serverInstalledLabel.Content = String.Format("ValheimPlus {0} installed on server", Settings.ValheimPlusServerClientVersion); statusSnackBar.MessageQueue.Enqueue("Success! Server client updated to latest version"); installServerUpdateButton.Content = "Update installed!"; installServerUpdateButton.IsEnabled = false; statusLabel.Visibility = Visibility.Hidden; } } }
public void GetSettingsTest() { Assert.IsNotNull(SettingsDAL.GetSettings()); }