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

            Assert.IsNotNull(settings);

            Assert.IsTrue(ValidationManager.CheckServerInstallationPath(settings.ServerInstallationPath));
        }
Пример #2
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);
            }
        }