public void CheckInstallationStatusTest()
        {
            // Fetching path settings
            Settings settings = SettingsDAL.GetSettings();

            Assert.IsNotNull(settings);

            Assert.IsTrue(ValidationManager.CheckInstallationStatus(settings.ClientInstallationPath));
            Assert.IsTrue(ValidationManager.CheckInstallationStatus(settings.ServerInstallationPath));
        }
Пример #2
0
        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!");
                }
            }
        }
Пример #3
0
        private void installServerButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult messageBoxResult;

            if (!ValheimPlusInstalledServer)
            {
                messageBoxResult = MessageBox.Show("Are you sure you wish to install ValheimPlus on your server?", "Confirm", MessageBoxButton.YesNo);
            }
            else
            {
                messageBoxResult = MessageBox
                                   .Show("Are you sure you wish to reinstall ValheimPlus on your server? This will overwrite your current configurations!", "Confirm");
            }

            if (messageBoxResult == MessageBoxResult.OK)
            {
                try
                {
                    FileManager.CopyFromTo(Settings.ServerPath, Settings.ServerInstallationPath);
                    ValheimPlusInstalledServer = ValidationManager.CheckInstallationStatus(Settings.ServerInstallationPath);
                    if (ValheimPlusInstalledServer)
                    {
                        serverInstalledLabel.Content    = String.Format("ValheimPlus {0} installed on server", Settings.ValheimPlusServerClientVersion);
                        serverInstalledLabel.Foreground = Brushes.Green;
                        installServerButton.Content     = "Reinstall ValheimPlus on server";

                        statusSnackBar.MessageQueue.Enqueue("Success! Server client has been installed");
                        UISettingsInit();
                    }
                }
                catch (Exception)
                {
                    statusSnackBar.MessageQueue.Enqueue("An error occured, report it to the devs!");
                }
            }
        }
Пример #4
0
        public void UISettingsInit()
        {
            if (ValidationManager.CheckClientInstallationPath(Settings.ClientInstallationPath))
            {
                ValheimPlusInstalledClient = ValidationManager.CheckInstallationStatus(Settings.ClientInstallationPath);

                if (ValheimPlusInstalledClient)
                {
                    clientInstalledLabel.Content    = String.Format("ValheimPlus {0} installed on client", Settings.ValheimPlusGameClientVersion);
                    clientInstalledLabel.Foreground = Brushes.Green;
                    installClientButton.Content     = "Reinstall ValheimPlus on client";

                    var modActive = File.Exists(String.Format("{0}winhttp.dll", Settings.ClientInstallationPath));
                    if (modActive)
                    {
                        enableDisableValheimPlusGameClientButton.Content = "Disable ValheimPlus";
                        enableDisableValheimPlusGameClientButton.Style   = Application.Current.TryFindResource("MaterialDesignOutlinedButton") as Style;
                    }
                    else
                    {
                        enableDisableValheimPlusGameClientButton.Content = "Enable ValheimPlus";
                        enableDisableValheimPlusGameClientButton.Style   = Application.Current.TryFindResource("MaterialDesignRaisedButton") as Style;
                    }

                    installClientButton.Visibility       = Visibility.Visible;
                    manageClientButton.Visibility        = Visibility.Visible;
                    installClientUpdateButton.Visibility = Visibility.Visible;
                    checkClientUpdatesButtons.Visibility = Visibility.Visible;
                    enableDisableValheimPlusGameClientButton.Visibility = Visibility.Visible;
                    setClientPathButton.Visibility = Visibility.Hidden;
                }
                else
                {
                    clientInstalledLabel.Content    = "ValheimPlus not installed on client";
                    clientInstalledLabel.Foreground = Brushes.Red;

                    manageClientButton.Visibility        = Visibility.Hidden;
                    installClientUpdateButton.Visibility = Visibility.Hidden;
                    checkClientUpdatesButtons.Visibility = Visibility.Hidden;
                    enableDisableValheimPlusGameClientButton.Visibility = Visibility.Hidden;
                    setClientPathButton.Visibility = Visibility.Hidden;
                }
            }
            else
            {
                clientInstalledLabel.Content    = "Valheim installation not found, select installation path by locating and choosing 'valheim.exe'";
                clientInstalledLabel.Foreground = Brushes.Red;

                manageClientButton.Visibility        = Visibility.Hidden;
                installClientUpdateButton.Visibility = Visibility.Hidden;
                checkClientUpdatesButtons.Visibility = Visibility.Hidden;
                enableDisableValheimPlusGameClientButton.Visibility = Visibility.Hidden;
                installClientButton.Visibility = Visibility.Hidden;
                setClientPathButton.Margin     = new Thickness(16, 78, 0, 0);
            }

            if (ValidationManager.CheckServerInstallationPath(Settings.ServerInstallationPath))
            {
                ValheimPlusInstalledServer = ValidationManager.CheckInstallationStatus(Settings.ServerInstallationPath);

                if (ValheimPlusInstalledServer)
                {
                    serverInstalledLabel.Content    = String.Format("ValheimPlus {0} installed on server", Settings.ValheimPlusServerClientVersion);
                    serverInstalledLabel.Foreground = Brushes.Green;
                    installServerButton.Content     = "Reinstall ValheimPlus on server";

                    installServerButton.Visibility       = Visibility.Visible;
                    manageServerButton.Visibility        = Visibility.Visible;
                    installServerUpdateButton.Visibility = Visibility.Visible;
                    checkServerUpdatesButton.Visibility  = Visibility.Visible;
                    setServerPathButton.Visibility       = Visibility.Hidden;
                }
                else
                {
                    serverInstalledLabel.Content    = "ValheimPlus not installed on server";
                    serverInstalledLabel.Foreground = Brushes.Red;

                    manageServerButton.Visibility        = Visibility.Hidden;
                    installServerUpdateButton.Visibility = Visibility.Hidden;
                    checkServerUpdatesButton.Visibility  = Visibility.Hidden;
                }
            }
            else
            {
                serverInstalledLabel.Content         = "Valheim installation not found, select installation path by locating and choosing 'valheim__server.exe'";
                serverInstalledLabel.Foreground      = Brushes.Red;
                manageServerButton.Visibility        = Visibility.Hidden;
                installServerUpdateButton.Visibility = Visibility.Hidden;
                checkServerUpdatesButton.Visibility  = Visibility.Hidden;
                installServerButton.Visibility       = Visibility.Hidden;
                setServerPathButton.Margin           = new Thickness(16, 85, 0, 0);
            }
        }