Ejemplo n.º 1
0
        //This function will use a temp file to update the grid, used for adding new rows.
        private void ReloadGridWithExternalChanges(string csvStringUsedToUpdateGrid)
        {
            string pathToTempFile = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "TMP_" + LocalizationFileObject.LOCALIZATION_FILE_NAME);

            XmlFileManager.WriteStringToFile(Directory.GetCurrentDirectory(), "TMP_" + LocalizationFileObject.LOCALIZATION_FILE_NAME, csvStringUsedToUpdateGrid);
            ReloadModLocalizationGrid(pathToTempFile);
        }
        private void SaveFile()
        {
            string xmlOut    = XmlOutputBox.Text;
            string isInvalid = XmlXpathGenerator.ValidateXml(xmlOut);

            if (isInvalid != null)
            {
                MessageBoxResult saveInvalidXmlDecision = MessageBox.Show(
                    "The xml is not valid! Would you like to save anyway?\n\n" + isInvalid,
                    "Invalid XML!",
                    MessageBoxButton.YesNo,
                    MessageBoxImage.Error);
                switch (saveInvalidXmlDecision)
                {
                case MessageBoxResult.No:
                    return;
                }
            }
            string parentPath = Wrapper.XmlFile.ParentPath ?? "";

            if (!String.IsNullOrEmpty(xmlOut))
            {
                XmlFileManager.WriteStringToFile(Path.Combine(this.FileLocationPath, parentPath), Wrapper.XmlFile.FileName, xmlOut);
                if (Properties.Settings.Default.AutoMoveMod)
                {
                    XmlFileManager.CopyAllOutputFiles();
                }
                StartingFileContents = xmlOut;
                this.Title           = this.StartingTitle;
            }
        }
        private void DirectEditView_Closing(object sender, CancelEventArgs e)
        {
            if (IsFileChanged())
            {
                MessageBoxResult result = MessageBox.Show(
                    "You have unsaved changes! Would you like to save them now?",
                    "Save Changes",
                    MessageBoxButton.YesNoCancel,
                    MessageBoxImage.Warning);
                switch (result)
                {
                case MessageBoxResult.Yes:
                    string parentString = Wrapper.XmlFile.ParentPath ?? "";
                    string xmlOut       = XmlOutputBox.Text;
                    if (!String.IsNullOrEmpty(xmlOut))
                    {
                        XmlFileManager.WriteStringToFile(Path.Combine(XmlFileManager.ModConfigOutputPath, parentString), Wrapper.XmlFile.FileName, xmlOut, true);
                    }
                    break;

                case MessageBoxResult.Cancel:
                    DirectEditView directEditView = new DirectEditView(this.Wrapper, this.DictionaryKey, this.IsGameFile, this.IsFirstWindowOpen, this.StartingTitle, XmlOutputBox.Text, FileLocationPath, this.UnchangedStartingFileContents);
                    directEditView.Show();
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        private void AddNewGridWithRecord(string gameKeyRecord)
        {
            string pathToTempFile = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "TMP_" + LocalizationFileObject.LOCALIZATION_FILE_NAME);

            XmlFileManager.WriteStringToFile(Directory.GetCurrentDirectory(), "TMP_" + LocalizationFileObject.LOCALIZATION_FILE_NAME, gameKeyRecord);
            GameRecordGridUserControl      = new LocalizationGridUserControl(pathToTempFile, true);
            GameRecordScrollViewer.Content = GameRecordGridUserControl;
        }
        private void SaveModInfo(string modNameToUse)
        {
            ModInfo newModIfo     = new ModInfo(ModInfoNameBox.Text, ModInfoDescriptionBox.Text, ModInfoAuthorBox.Text, ModInfoVersionBox.Text);
            string  modInfoXmlOut = newModIfo.ToString();

            ModInfo.CreateModInfoFile(modNameToUse);
            XmlFileManager.WriteStringToFile(XmlFileManager.Get_ModDirectoryOutputPath(modNameToUse), ModInfo.MOD_INFO_FILE_NAME, modInfoXmlOut);
            ResetModNameComboBoxes(modNameToUse);
            MessageBox.Show("Saved mod info for " + modNameToUse + ".", "Saving Mod info", MessageBoxButton.OK, MessageBoxImage.Information);
        }
        private void SaveModInfo(string modNameToUse)
        {
            ModInfo.CreateModInfoFile(modNameToUse);
            ResetModNameComboBoxes(modNameToUse);
            ModInfo newModIfo     = new ModInfo(ModInfoNameBox.Text, ModInfoDescriptionBox.Text, ModInfoAuthorBox.Text, ModInfoVersionBox.Text);
            string  modInfoXmlOut = newModIfo.ToString();
            bool    didSucceed    = XmlFileManager.WriteStringToFile(XmlFileManager.Get_ModDirectoryOutputPath(modNameToUse), ModInfo.MOD_INFO_FILE_NAME, modInfoXmlOut);

            if (didSucceed)
            {
                MessageBox.Show("Saved mod info for " + modNameToUse + ".", "Saving Mod info", MessageBoxButton.OK, MessageBoxImage.Information);
                ResetModNameComboBoxes(modNameToUse);
            }
            else
            {
                MessageBox.Show("Created new mod, with empty. Simply reselecting the mod in the combo box above may fix the issue. Alternatively, select another mod and reselect the mod you would like to edit.",
                                "Save Mod Info Failed", MessageBoxButton.OK, MessageBoxImage.Error);
                ResetModNameComboBoxes(modNameToUse);
            }
        }
Ejemplo n.º 7
0
 private void SaveLocalization()
 {
     XmlFileManager.WriteStringToFile(XmlFileManager.Get_ModOutputPath(ModSelectionComboBox.SelectedItem.ToString()), LocalizationFileObject.LOCALIZATION_FILE_NAME, LocalizationPreviewBox.Text);
     ModLocalizationGridUserControl.SetGridChangedToFalse();
 }