private void SaveButton_Click(object sender, System.Windows.RoutedEventArgs e) { if (String.IsNullOrEmpty(ChangeNameAllTagsComboBox.Text)) { string currentSelectedModTag = AllTagsComboBox.Text; SaveModInfo(currentSelectedModTag); } else { //prompt user to create new mod with text provided string message = "The selected mod name provided does not exist, would you like to create it as a new mod now with all provided modinfo values?"; MessageBoxResult results = MessageBox.Show(message, "Create New Mod", MessageBoxButton.YesNo, MessageBoxImage.Question); switch (results) { case MessageBoxResult.Yes: List <string> allCustomModsInPath = XmlFileManager.GetCustomModFoldersInOutput(); //If the new name is not in te output path if (!allCustomModsInPath.Contains(ChangeNameAllTagsComboBox.Text)) { SaveModInfo(ChangeNameAllTagsComboBox.Text); } else { string modExistsMessage = "The new mod name cannot already exist in the output location.\n\n" + "You must use different name or delete the other mod folder in the output location."; MessageBox.Show(modExistsMessage, "Mod Name Exists", MessageBoxButton.OK, MessageBoxImage.Error); } break; case MessageBoxResult.No: ChangeNameAllTagsComboBox.Text = ""; break; } } }
internal void RefreshMainUIComboboxes(ComboBox currentModLoadedFilesCenterViewComboBox, ComboBox loadedModsCenterViewComboBox, ComboBox loadedModsSearchViewComboBox) { currentModLoadedFilesCenterViewComboBox.SetComboBox(XmlFileManager.GetCustomModFilesInOutput(Properties.Settings.Default.ModTagSetting, Properties.Settings.Default.ModTagSetting + "_")); loadedModsCenterViewComboBox.SetComboBox(XmlFileManager.GetCustomModFoldersInOutput()); loadedModsSearchViewComboBox.SetComboBox(XmlFileManager.GetCustomModFoldersInOutput()); loadedModsCenterViewComboBox.Text = Properties.Settings.Default.ModTagSetting; }
public void LoadStartingDirectory(ComboBox searchTreeLoadedFilesComboBox, ComboBox newObjectViewLoadedFilesComboBox, ComboBox currentModLoadedFilesCenterViewComboBox, ComboBox loadedModsSearchViewComboBox, ComboBox CurrentGameFilesCenterViewComboBox) { Directory.CreateDirectory(XmlFileManager.LoadedFilesPath); Directory.CreateDirectory(Path.Combine(XmlFileManager.LoadedFilesPath, XmlFileManager.Xui_Folder_Name)); Directory.CreateDirectory(Path.Combine(XmlFileManager.LoadedFilesPath, XmlFileManager.Xui_Menu_Folder_Name)); //Check normal files string[] files = Directory.GetFiles(XmlFileManager.LoadedFilesPath, "*.xml"); LoadFilesPathWrappers(files, searchTreeLoadedFilesComboBox, newObjectViewLoadedFilesComboBox, CurrentGameFilesCenterViewComboBox); //Check for Xui files string[] xuiFiles = Directory.GetFiles(Path.Combine(XmlFileManager.LoadedFilesPath, XmlFileManager.Xui_Folder_Name)); if (xuiFiles.Length > 0) { LoadFilesPathWrappers(xuiFiles, searchTreeLoadedFilesComboBox, newObjectViewLoadedFilesComboBox, CurrentGameFilesCenterViewComboBox); } //Check for Xui menu files string[] xuiMenuFiles = Directory.GetFiles(Path.Combine(XmlFileManager.LoadedFilesPath, XmlFileManager.Xui_Menu_Folder_Name)); if (xuiMenuFiles.Length > 0) { LoadFilesPathWrappers(xuiMenuFiles, searchTreeLoadedFilesComboBox, newObjectViewLoadedFilesComboBox, CurrentGameFilesCenterViewComboBox); } List <string> allCustomTagDirectories = XmlFileManager.GetCustomModFoldersInOutput(); loadedModsSearchViewComboBox.AddUniqueValueTo(""); foreach (string nextModTag in allCustomTagDirectories) { loadedModsSearchViewComboBox.AddUniqueValueTo(nextModTag); LoadCustomTagWrappers(nextModTag, currentModLoadedFilesCenterViewComboBox); } }
private void MyWindow_Loaded(object sender, RoutedEventArgs e) { string openingText = "Thank you for downloading the 7 days to die Mod Creator! \n" + "If you have any issues please report them in the comments on the nexus page.\n\n" + "IMPORTANT: If you lose work check the log.txt in the Output folder.\n" + "Any time you close the app or clear the object view, the xml that could be generated is output in that log.\n\n" + "If you like the application don't forget to leave me a comment or better yet drop an endorsment!\n" + "Good luck with your mods!"; this.XmlOutputBox.Text = openingText; this.LoadedListWrappers = new Dictionary <string, XmlObjectsListWrapper>(); this.MainWindowFileController = new MainWindowFileController(this.LoadedListWrappers); this.MainWindowViewController = new MainWindowViewController(); MainWindowViewController.XmlOutputBox = this.XmlOutputBox; MainWindowViewController.LoadedListWrappers = this.LoadedListWrappers; SetPanels(); SetCustomModViewElements(); SetEvents(); MainWindowViewController.IncludeAllModsCheckBox = this.IncludeAllModsInBoxesCheckBox; this.IncludeCommentsCheckBox.IsChecked = Properties.Settings.Default.IncludeCommentsSearchTreeTooltip; this.IncludeChildrenInOnHoverCheckBox.IsChecked = Properties.Settings.Default.IncludeChildrenSearchTreeTooltip; this.IncludeAllModsInBoxesCheckBox.IsChecked = Properties.Settings.Default.IncludeAllModsObjectTreeAttributes; this.IgnoreAllAttributesCheckBox.IsChecked = Properties.Settings.Default.IgnoreAllAttributesCheckbox; this.IgnoreAllAttributesCheckBox.Click += IgnoreAllAttributesCheckBox_Click; MainWindowFileController.LoadStartingDirectory(SearchTreeLoadedFilesComboBox, NewObjectViewLoadedFilesComboBox, CurrentModFilesCenterViewComboBox, LoadedModsSearchViewComboBox, CurrentGameFilesCenterViewComboBox); this.LoadedModsCenterViewComboBox.SetComboBox(XmlFileManager.GetCustomModFoldersInOutput()); this.CurrentModFilesCenterViewComboBox.SetComboBox(XmlFileManager.GetCustomModFilesInOutput(Properties.Settings.Default.ModTagSetting, Properties.Settings.Default.ModTagSetting + "_")); this.LoadedModsCenterViewComboBox.Text = Properties.Settings.Default.ModTagSetting; SetMainWindowToolTips(); SetBackgroundFromSetting(); }
public LocalizationSettingWindow(Dictionary <string, XmlObjectsListWrapper> loadedListWrappers) { InitializeComponent(); Closing += new CancelEventHandler(LocalizatonSettingWindow_Closing); AddTooltips(); StartingMod = Properties.Settings.Default.ModTagSetting; WindowTitle = StartingMod.ToString(); this.Title = GetTitleForWindow(); this.LoadedListWrappers = loadedListWrappers; string pathToModLocalizationFile = XmlFileManager.ModConfigOutputPath + LocalizationFileObject.LOCALIZATION_FILE_NAME; ModLocalizationGridUserControl = new LocalizationGridUserControl(pathToModLocalizationFile); GridAsCSVAfterUpdate = ModLocalizationGridUserControl.Maingrid.GridAsCSV(); List <string> allCustomTagDirectories = XmlFileManager.GetCustomModFoldersInOutput(); foreach (string nextModTag in allCustomTagDirectories) { ModSelectionComboBox.AddUniqueValueTo(nextModTag); } ModSelectionComboBox.SelectedItem = Properties.Settings.Default.ModTagSetting; ModSelectionComboBox.DropDownClosed += ModSelectionComboBox_DropDownClosed; ModLocalizationScrollViewer.Content = ModLocalizationGridUserControl; string pathToGameLocalizationFile = XmlFileManager.LoadedFilesPath + LocalizationFileObject.LOCALIZATION_FILE_NAME; GameLocalizationFile = new LocalizationFileObject(pathToGameLocalizationFile); TextEditorOptions newOptions = new TextEditorOptions { EnableRectangularSelection = true, EnableTextDragDrop = true, HighlightCurrentLine = true, ShowTabs = true }; LocalizationPreviewBox.ShowLineNumbers = true; LocalizationPreviewBox.TextArea.Options = newOptions; LocalizationPreviewBox.Text = ModLocalizationGridUserControl.Maingrid.GridAsCSV(); LocalizationPreviewBox.LostFocus += LocalizationPreviewBox_LostFocus; SearchPanel.Install(LocalizationPreviewBox); ModLocalizationScrollViewer.GotFocus += Maingrid_GotOrLostFocus; ModLocalizationScrollViewer.LostFocus += Maingrid_GotOrLostFocus; SortedSet <string> gameFileKeysSorted = GameLocalizationFile.HeaderKeyToCommonValuesMap.GetValueOrDefault(GameLocalizationFile.KeyColumn); List <string> gameFileKeys = new List <string>(gameFileKeysSorted); GameKeySelectionComboBox.SetComboBox(gameFileKeys); GameKeySelectionComboBox.IsEditable = true; GameKeySelectionComboBox.DropDownClosed += GameKeySelectionComboBox_DropDownClosed; GameKeySelectionComboBox.PreviewKeyDown += GameKeySelectionComboBox_PreviewKeyDown; SetBackgroundColor(); }
private void ResetModNameComboBoxes(string modNameToSetBox) { if (FirstRowStackPanel.Children.Contains(this.AllTagsComboBox)) { FirstRowStackPanel.Children.Remove(this.AllTagsComboBox); } List <string> allCustomModsInPath = XmlFileManager.GetCustomModFoldersInOutput(); this.ChangeNameAllTagsComboBox.SetComboBox(allCustomModsInPath); this.AllTagsComboBox = allCustomModsInPath.CreateComboBoxFromList(isEditable: false); this.AllTagsComboBox.DropDownClosed += AllTagsComboBox_DropDownClosed; this.AllTagsComboBox.SelectionChanged += AllTagsComboBox_SelectionChanged; this.AllTagsComboBox.FontSize = 22; this.AllTagsComboBox.SelectedItem = modNameToSetBox; FirstRowStackPanel.Children.Add(this.AllTagsComboBox); }
private void ChangeModTagButton_Click(object sender, RoutedEventArgs e) { List <string> allCustomModsInPath = XmlFileManager.GetCustomModFoldersInOutput(); string currentSelectedModTag = AllTagsComboBox.Text; string newModName = ChangeNameAllTagsComboBox.Text; //if the current selected mod name is not the last selected if (!currentSelectedModTag.Equals(newModName)) { // and is does not exist in the mod output folder already if (!allCustomModsInPath.Contains(newModName)) { if (VerifyTagNameCorrectness(newModName)) { try { //We can change the name ChangeModTagName(currentSelectedModTag, newModName); ResetModNameComboBoxes(currentSelectedModTag); string message = "Successfully changed the mod name from " + currentSelectedModTag + " to " + newModName + "."; MessageBox.Show(message, "Change Mod Name", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception exception) { XmlFileManager.WriteStringToLog("ERROR changing mod name. Exception:\n " + exception.ToString() + " \nMessage: " + exception.Message); string message = "Error attempting to change the name for the mod " + currentSelectedModTag + "." + "\nError:\n\n" + exception.Message; MessageBox.Show(message, "Change Mod Name Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } //the name already exists else { string message = "The new mod name cannot already exist in the output location.\n\n" + "You must use different name or delete the other mod folder in the output location."; MessageBox.Show(message, "Mod Name Exists", MessageBoxButton.OK, MessageBoxImage.Error); } } //The name is the same as the selected mod else { MessageBox.Show("The selected mod, and the new mod name must be different", "Mod Name Unchanged", MessageBoxButton.OK, MessageBoxImage.Error); } }