Adjusted the exporter to match the imported file better

This commit is contained in:
Daniel Schick 2025-09-11 08:25:34 +02:00
parent e7ca08c65d
commit ec81631bd8

View File

@ -21,6 +21,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace ENI2.Controls namespace ENI2.Controls
@ -69,11 +70,25 @@ namespace ENI2.Controls
{ {
try try
{ {
using (var fs = File.Create(dlg.FileName)) var ser = new XmlSerializer(typeof(ProofRequest));
// Namespaces (if needed)
// var ns = new XmlSerializerNamespaces();
// ns.Add("xsd", "http://www.w3.org/2001/XMLSchema");
// ns.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
var settings = new XmlWriterSettings
{ {
var ser = new XmlSerializer(typeof(ProofRequest)); Indent = true,
ser.Serialize(fs, _vm); OmitXmlDeclaration = true
};
using (var fs = File.Create(dlg.FileName))
using (var xw = XmlWriter.Create(fs, settings))
{
ser.Serialize(xw, _vm); //, ns);
} }
MessageBox.Show("Exported successfully.", "easy-peasy", MessageBoxButton.OK, MessageBoxImage.Information); MessageBox.Show("Exported successfully.", "easy-peasy", MessageBoxButton.OK, MessageBoxImage.Information);
} }
catch (Exception ex) catch (Exception ex)