/// <summary> /// The event handler for the advanced options button clicked /// </summary> private void AdvOptionsButton_Click(object sender, RoutedEventArgs e) { var selectedItem = ModelTypeComboBox.SelectedItem as ModComboBox; var mod = selectedItem.SelectedMod; var includedMod = new IncludedMods { Name = $"{Path.GetFileNameWithoutExtension(mod.fullPath)} ({((Category)ModListTreeView.SelectedItem).Name})", FullPath = mod.fullPath }; var itemModel = MakeItemModel(mod); var includedModsList = IncludedModsList.Items.Cast <IncludedMods>().ToList(); var mdl = new Mdl(_gameDirectory, XivDataFiles.GetXivDataFile(mod.datFile)); var xivMdl = mdl.GetMdlData(itemModel, GetRace(mod.fullPath), null, null, mod.data.originalOffset); var advancedImportView = new AdvancedModelImportView(xivMdl, itemModel, GetRace(mod.fullPath), true); var result = advancedImportView.ShowDialog(); if (result == true) { if (includedModsList.Any(item => item.Name.Equals(includedMod.Name))) { if (FlexibleMessageBox.Show( $"This Option already includes {includedMod.Name} \n\n Would you like to overwrite the existing mod for this option?", "Overwrite?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { _selectedModOption.Mods[mod.fullPath].ModDataBytes = advancedImportView.RawModelData; } } else { IncludedModsList.Items.Add(includedMod); _selectedModOption.Mods.Add(mod.fullPath, new ModData { Name = mod.name, Category = mod.category, FullPath = mod.fullPath, ModDataBytes = advancedImportView.RawModelData }); } } }
public AdvancedImportViewModel(XivMdl xivMdl, IItemModel itemModel, XivRace selectedRace, AdvancedModelImportView view) { var appStyle = ThemeManager.DetectAppStyle(System.Windows.Application.Current); if (appStyle.Item1.Name.Equals("BaseDark")) { _textColor = "White"; } _view = view; _xivMdl = xivMdl; _lod = xivMdl.LoDList[0]; _itemModel = itemModel; _selectedRace = selectedRace; _dae = new Dae(new DirectoryInfo(Settings.Default.FFXIV_Directory), itemModel.DataFile); Initialize(); }