Example #1
0
        private void morrowindLocationTextbox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            Morrowind.morrowindPath = morrowindLocationTextbox.Text;

            if (Morrowind.CheckLocation(Morrowind.morrowindPath))
            {
                morrowindSuccessTick.Visibility = Visibility.Visible;
            }
            else
            {
                morrowindSuccessTick.Visibility = Visibility.Hidden;
            }

            CheckInstallability();
        }
        private bool CheckInstallability(bool forceFail = false)
        {
            bool readyForInstall = true;

            if (!Morrowind.CheckLocation(Morrowind.morrowindPath))
            {
                readyForInstall = false;
            }
            if (!Extraction.CheckLocation(Extraction.sevenZipPath))
            {
                readyForInstall = false;
            }
            if (!File.Exists(packageListLocationTextbox.Text))
            {
                readyForInstall = false;
            }

            bool nexusWarnings = false;

            if (packages != null)
            {
                //Update Nexus requirement
                bool reqNex = false;
                foreach (Package p in packages)
                {
                    if (!p.requiresNexus)
                    {
                        continue;
                    }
                    reqNex = true;
                    break;
                }

                nexusWarnings = (reqNex && !(nexusAPIKeyTextBox.Text.Trim().Length > 0)) || forceFail;
            }
            else
            {
                readyForInstall = false;
            }

            nexusWarning.Visibility       = nexusWarnings ? Visibility.Visible : Visibility.Hidden;
            nexusAPIKeyWarning.Visibility = nexusWarnings ? Visibility.Visible : Visibility.Hidden;
            nexusSuccessTick.Visibility   = !nexusWarnings ? Visibility.Visible : Visibility.Hidden;

            installButton.IsEnabled      = !nexusWarnings && readyForInstall;
            installReadyImage.Visibility = !nexusWarnings && readyForInstall ? Visibility.Visible : Visibility.Hidden;
            return(readyForInstall);
        }
Example #3
0
        public static void LoadConfig()
        {
            Log.Write("\nLoading config...");
            string reg;

            reg = GetRegistryValue(K_morrowindPath);
            Morrowind.morrowindPath = reg == "" ? Morrowind.GetInstallLocation() : reg;

            reg = GetRegistryValue(K_packageListPath);
            Config.packageListPath = reg == "" ? Path.Combine(Morrowind.morrowindPath, "packageList.json") : reg;

            reg = GetRegistryValue(K_sevenZipPath);
            Extraction.sevenZipPath = reg == "" ? Extraction.GetInstallLocation() : reg;

            reg          = GetRegistryValue(K_nexusAPIKey);
            Nexus.apiKey = reg;

            Config.hideStartupWarning = GetRegistryBool(K_hideStartupWarning);
            Log.Write(" done.");
        }