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 ValidateXmlMenuItem_Click(object sender, RoutedEventArgs e)
        {
            string modOutputPath = XmlFileManager.Get_ModOutputPath(Properties.Settings.Default.ModTagSetting);

            string[]      modOutputFiles = Directory.GetFiles(modOutputPath);
            StringBuilder builder        = new StringBuilder();

            foreach (string modFile in modOutputFiles)
            {
                string isInvalid = XmlXpathGenerator.ValidateXml(XmlFileManager.ReadExistingFile(modFile));
                //The xml is valid
                if (isInvalid == null)
                {
                    builder.AppendLine("File: " + Path.GetFileName(modFile));
                    builder.AppendLine("Valid");
                }
                else
                {
                    builder.Insert(0, isInvalid);
                    builder.Insert(0, "File: " + Path.GetFileName(modFile) + "\n");
                }
            }
            builder.Insert(0, "All files: \n");
            builder.Insert(0, "Xml Validation for mod " + Properties.Settings.Default.ModTagSetting + "\n\n");
            //Remove the trailing newline
            builder.Remove(builder.Length - 2, 2);
            MessageBox.Show(builder.ToString(), "Xml Validation", MessageBoxButton.OK, MessageBoxImage.Information);
            this.MainWindowFileController.LoadCustomTagWrappers(Properties.Settings.Default.ModTagSetting, this.CurrentModFilesCenterViewComboBox);
        }
        private void CombineTagsXmlButton_Click(object sender, RoutedEventArgs e)
        {
            string allXml = this.XmlOutputBox.Text;

            if (XmlXpathGenerator.ValidateXml(allXml, errorPrependMessage: "Error: Could not execute combine function because xml is invalid."))
            {
                this.XmlOutputBox.Text = XmlXpathGenerator.CombineAppendTags(this.Wrapper, allXml);
            }
        }
 private void ValidateXmlButton_Click(object sender, RoutedEventArgs e)
 {
     XmlXpathGenerator.ValidateXml(XmlOutputBox.Text, doShowValidationMessage: true);
 }