private void ChangeEnvPathButton_Click(object sender, RoutedEventArgs e) { Application.Current.Dispatcher.Invoke((Action) delegate { var chooseEnvPathWindow = new ChooseEnvPathWindow(); chooseEnvPathWindow.ShowDialog(); }); }
public static void LoadSettings(bool ForceToSet = false) { var ForceToLoad = ForceToSet; while (true) { EnvVars = new Dictionary <string, string>(); UserVars = new Dictionary <string, string>(); EnvLines = new Dictionary <string, int>(); GetListFromGithub(); var properties = new[] { "EnvPath", "ARCHITECTURE", "AUTOMUTEUS_TAG", "GALACTUS_TAG", "WINGMAN_TAG", "AUTOMUTEUS_AUTORESTART", "GALACTUS_AUTORESTART", "WINGMAN_AUTORESTART" }; foreach (string property in properties) { if (property != "RVC_Hash") { UserVars.Add(property, (string)Properties.Settings.Default[property]); } } logger.Debug("UserVars loaded."); logger.Debug("########## UserVars ##########"); logger.Debug(JsonConvert.SerializeObject(UserVars)); logger.Debug("##############################"); if (!Directory.Exists(GetUserVar("EnvPath"))) { Application.Current.Dispatcher.Invoke((Action) delegate { var chooseEnvPathWindow = new ChooseEnvPathWindow(); chooseEnvPathWindow.ShowDialog(); }); SettingsWindow.useRecommendedVersionCombination = true; } logger.Info($"EnvPath: {GetUserVar("EnvPath")}"); var requiredComponent = Main.RequiredComponents[GetUserVar("ARCHITECTURE")]; if (!File.Exists(Path.Combine(GetUserVar("EnvPath"), ".env"))) { DownloadEnv(GetUserVar("EnvPath"), GetUserVar("ARCHITECTURE")); } if (!File.Exists(Path.Combine(GetUserVar("EnvPath"), "diffenvs.json"))) { LoadDiffEnvs(GetUserVar("EnvPath"), GetUserVar("ARCHITECTURE")); } EnvVars = LoadEnv(Path.Combine(GetUserVar("EnvPath"), ".env")); logger.Debug("EnvVars loaded."); logger.Debug("########## EnvVars ##########"); logger.Debug(JsonConvert.SerializeObject(EnvVars)); logger.Debug("#############################"); if (CheckAllRequiredVariable(UserVars, EnvVars) || ForceToSet) { Application.Current.Dispatcher.Invoke((Action) delegate { var settingsWindow = new SettingsWindow(); if (!settingsWindow.hasClosed) { settingsWindow.ShowDialog(); } }); ForceToSet = false; } else { try { LoadBinaries(ForceToLoad); if (requiredComponent.Contains("postgres")) { SetupPostgres(); } return; } catch (Exception e) { logger.Error($"{LocalizationProvider.GetLocalizedValue<string>("MainLogger_FailToLoadBinary")} {e.Message}"); continue; } } } }