From ec81631bd866a917c5a20fb8cd0f2e8687a71146 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 11 Sep 2025 08:25:34 +0200 Subject: [PATCH] Adjusted the exporter to match the imported file better --- ENI2/Controls/EasyPeasyControl.xaml.cs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ENI2/Controls/EasyPeasyControl.xaml.cs b/ENI2/Controls/EasyPeasyControl.xaml.cs index f3964a8e..0d1cbabf 100644 --- a/ENI2/Controls/EasyPeasyControl.xaml.cs +++ b/ENI2/Controls/EasyPeasyControl.xaml.cs @@ -21,6 +21,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using System.Xml; using System.Xml.Serialization; namespace ENI2.Controls @@ -69,11 +70,25 @@ namespace ENI2.Controls { 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)); - ser.Serialize(fs, _vm); + Indent = true, + 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); } catch (Exception ex)