/// <summary> /// Displays the latest status of the plugins on the opening screen (disabled, enabled, version, installed). /// </summary> public static void DisplayAddonStatus() { UserConfig config_obj = getConfigAsYAML(); foreach (AddonInfoFromYaml addon in OpeningViewModel.GetInstance.AddonList) { addon.addon_name = AddonYamlReader.getAddonInInfo(addon.folder_name).addon_name; if (config_obj.installed.ContainsKey(addon.folder_name) && config_obj.version.ContainsKey(addon.folder_name)) { if (addon.folder_name == "arcdps" || addon.folder_name == "buildPad" || config_obj.version[addon.folder_name].Length > 10) { addon.addon_name += " (installed)"; } else { addon.addon_name += " (" + config_obj.version[addon.folder_name] + " installed)"; } } if (config_obj.disabled.ContainsKey(addon.folder_name) && config_obj.disabled[addon.folder_name] == true) { addon.addon_name += " (disabled)"; } } }
/***** UPDATE button *****/ private void update_button_clicked(object sender, RoutedEventArgs e) { //If bin folder doesn't exist then LoaderSetup intialization will fail. if (_configurationManager.UserConfig.BinFolder == null) { MessageBox.Show("Unable to locate Guild Wars 2 /bin/ or /bin64/ folder." + Environment.NewLine + "Please verify Game Path is correct.", "Unable to Update", MessageBoxButton.OK, MessageBoxImage.Warning); return; } List <AddonInfoFromYaml> selectedAddons = new List <AddonInfoFromYaml>(); //the d3d9 wrapper is installed by default and hidden from the list displayed to the user, so it has to be added to this list manually AddonInfoFromYaml wrapper = AddonYamlReader.getAddonInInfo("d3d9_wrapper"); wrapper.folder_name = "d3d9_wrapper"; selectedAddons.Add(wrapper); foreach (AddonInfoFromYaml addon in OpeningViewModel.GetInstance.AddonList.Where(add => add.IsSelected == true)) { selectedAddons.Add(addon); } Application.Current.Properties["Selected"] = selectedAddons; this.NavigationService.Navigate(new Uri("UI/UpdatingPage/UpdatingView.xaml", UriKind.Relative)); }
/// <summary> /// Displays the latest status of the plugins on the opening screen (disabled, enabled, version, installed). /// </summary> public void DisplayAddonStatus() { foreach (var addon in OpeningViewModel.GetInstance.AddonList) { var addonConfig = _configurationManager.UserConfig.AddonsList[addon.folder_name]; if (addonConfig == null) { continue; } addon.addon_name = AddonYamlReader.getAddonInInfo(addon.folder_name).addon_name; if (addonConfig.Installed) { if (addon.folder_name == "arcdps" || addon.folder_name == "buildPad" || addonConfig.Version.Length > 10) { addon.Status += "(installed)"; } else { addon.Status += "(" + addonConfig.Version + " installed)"; } } if (addonConfig.Disabled) { addon.Status += "(disabled)"; } } }
/// <summary> /// Displays the latest status of the plugins on the opening screen (disabled, enabled, version, installed). /// </summary> /// <param name="viewModel">An instance of the <typeparamref>OpeningViewModel</typeparamref> class serving as the DataContext for the application UI.</param> public static void DisplayAddonStatus(OpeningViewModel viewModel) { UserConfig config_obj = getConfigAsYAML(); foreach (AddonInfo addon in viewModel.AddonList) { addon.addon_name = AddonYamlReader.getAddonInInfo(addon.folder_name).addon_name; if (config_obj.installed.ContainsKey(addon.folder_name) && config_obj.version.ContainsKey(addon.folder_name)) { if (addon.folder_name == "arcdps") { addon.addon_name += " (installed)"; } else { addon.addon_name += " (" + config_obj.version[addon.folder_name] + " installed)"; } } if (config_obj.disabled.ContainsKey(addon.folder_name) && config_obj.disabled[addon.folder_name] == true) { addon.addon_name += " (disabled)"; } } }
/// <summary> /// Displays the latest status of the plugins on the opening screen (disabled, enabled, version, installed). /// </summary> public void DisplayAddonStatus() { foreach (var addon in OpeningViewModel.GetInstance.AddonList) { var addonConfig = _configurationManager.UserConfig.AddonsList[addon.folder_name]; if (addonConfig == null) { continue; } addon.addon_name = AddonYamlReader.getAddonInInfo(addon.folder_name).addon_name; ChangeAddonStatus(addon); } }
/***************************** *** *****************************/ /***** UPDATE button *****/ private void update_button_clicked(object sender, RoutedEventArgs e) { List <AddonInfoFromYaml> selectedAddons = new List <AddonInfoFromYaml>(); AddonInfoFromYaml wrapper = AddonYamlReader.getAddonInInfo("d3d9_wrapper"); wrapper.folder_name = "d3d9_wrapper"; selectedAddons.Add(wrapper); foreach (AddonInfoFromYaml addon in OpeningViewModel.GetInstance.AddonList.Where(add => add.IsSelected == true)) { selectedAddons.Add(addon); } Application.Current.Properties["Selected"] = selectedAddons; this.NavigationService.Navigate(new Uri("UI/UpdatingPage/UpdatingView.xaml", UriKind.Relative)); }
/// <summary> /// Scans resources/addons directory to populate a collection used for displaying the list of available addons on the UI. /// </summary> /// <returns>A list of AddonInfo objects representing all approved add-ons.</returns> public ObservableCollection <AddonInfoFromYaml> GenerateAddonList() { FetchListFromRepo(); var addons = new ObservableCollection <AddonInfoFromYaml>(); //List of AddonInfo objects var addonDirectories = Directory.GetDirectories(AddonFolder); //Names of addon subdirectories in /resources/addons foreach (var addonFolderName in addonDirectories) { if (addonFolderName == "resources\\addons\\d3d9_wrapper") { continue; } var addonInfo = AddonYamlReader.getAddonInInfo(addonFolderName.Replace(AddonFolder + "\\", "")); addonInfo.folder_name = addonFolderName.Replace(AddonFolder + "\\", ""); addonInfo.IsSelected = _configManager.UserConfig.AddonsList[addonInfo.folder_name]?.Installed ?? false; addons.Add(addonInfo); //retrieving info from each addon subdirectory's update.yaml file and adding it to the list } return(addons); }
/// <summary> /// /// </summary> /// <returns>A list of AddonInfo objects representing all approved add-ons.</returns> public static ObservableCollection <AddonInfo> GenerateAddonList() { ObservableCollection <AddonInfo> Addons = new ObservableCollection <AddonInfo>(); //List of AddonInfo objects string[] AddonDirectories = Directory.GetDirectories("resources\\addons"); //Names of addon subdirectories in /resources/addons UserConfig userConfig = Configuration.getConfigAsYAML(); foreach (string addonFolderName in AddonDirectories) { if (addonFolderName != "resources\\addons\\d3d9_wrapper") { AddonInfo temp = AddonYamlReader.getAddonInInfo(addonFolderName.Replace("resources\\addons\\", "")); temp.folder_name = addonFolderName.Replace("resources\\addons\\", ""); if (userConfig.default_configuration.ContainsKey(temp.folder_name) && userConfig.default_configuration[temp.folder_name]) { temp.IsSelected = true; } Addons.Add(temp); //retrieving info from each addon subdirectory's update.yaml file and adding it to the list } } return(Addons); }