private void SetupRaces() { var races = Eqp.PlayableRaces; _view.RaceComboBox.SelectedValuePath = "Key"; _view.RaceComboBox.DisplayMemberPath = "Value"; _view.RaceComboBox.IsEnabled = false; if (_race == XivRace.All_Races) { _view.OverrideRaceButton.IsEnabled = false; var kv = new KeyValuePair <XivRace, string>(XivRace.All_Races, "--"); _view.RaceComboBox.Items.Add(kv); } else { foreach (var race in races) { var kv = new KeyValuePair <XivRace, string>(race, XivRaces.GetDisplayName(race)); _view.RaceComboBox.Items.Add(kv); } } _view.RaceComboBox.SelectedValue = _race; }
private void AddMaterial(string m) { if (_view.MaterialsSource.Any(x => x.Key == m)) { return; } var result = ItemMaterialRegex.Match(m); if (result.Success // This check is a little janky, but it's to avoid reading cross-slot references as the same item. // ... Not that this should ever really happen, but it's *technically* possible. && (_root.Info.Slot == null || m.Contains(_root.Info.Slot))) { // We have a new item material here that we haven't added to the list yet. var raceId = result.Groups[1].Value; var partId = result.Groups[2].Value; var race = XivRaces.GetXivRace(raceId); _view.MaterialsSource.Add(new KeyValuePair <string, string>(m, "Material " + partId.ToUpper() + " - " + XivRaces.GetDisplayName(race))); } else { _view.MaterialsSource.Add(new KeyValuePair <string, string>(m, Path.GetFileNameWithoutExtension(m))); } }
private void UpdateMaterialsList() { // Remove the Custom Tag at the end if it's there. _view.MaterialsSource.Remove(CustomTag); // If we don't have this already, we're in our first itteration of this function. if (!_view.MaterialsSource.Contains(SkinTag)) { _view.MaterialsSource.Add(SkinTag); } // Add in any new item materials. foreach (var m in _newModel.MeshGroups) { var result = ItemMaterialRegex.Match(m.Material); if (result.Success) { if (_view.MaterialsSource.Any(x => x.Key == m.Material)) { continue; } // We have a new item material here that we haven't added to the list yet. var raceId = result.Groups[1].Value; var partId = result.Groups[2].Value; var race = XivRaces.GetXivRace(raceId); _view.MaterialsSource.Add(new KeyValuePair <string, string>(m.Material, "Material " + partId.ToUpper() + " - " + XivRaces.GetDisplayName(race))); } } // Re-Add the custom tag. _view.MaterialsSource.Add(CustomTag); }