From 7860910f3cfb7a69224fedfced3aea74c357fe26 Mon Sep 17 00:00:00 2001 From: Kilian von Pflugk Date: Sun, 1 Sep 2024 18:34:25 +0200 Subject: [PATCH] undo namespace change for DataContract and migrate already changed xml files --- ConfusedPolarBear.Plugin.IntroSkipper/Data/Intro.cs | 2 +- .../XmlSerializationHelper.cs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Data/Intro.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Data/Intro.cs index 8df7e79..fcfa893 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Data/Intro.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Data/Intro.cs @@ -9,7 +9,7 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper.Data; /// Result of fingerprinting and analyzing two episodes in a season. /// All times are measured in seconds relative to the beginning of the media file. /// -[DataContract] +[DataContract(Namespace = "http://schemas.datacontract.org/2004/07/ConfusedPolarBear.Plugin.IntroSkipper")] public class Intro { /// diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/XmlSerializationHelper.cs b/ConfusedPolarBear.Plugin.IntroSkipper/XmlSerializationHelper.cs index b7d90ec..c8c168c 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/XmlSerializationHelper.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/XmlSerializationHelper.cs @@ -73,6 +73,14 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper // Save the modified XML document xmlDoc.Save(filePath); } + + // undo namespace change + if (xmlDoc.DocumentElement.NamespaceURI == "http://schemas.datacontract.org/2004/07/ConfusedPolarBear.Plugin.IntroSkipper.Data") + { + xmlDoc.DocumentElement.SetAttribute("xmlns", "http://schemas.datacontract.org/2004/07/ConfusedPolarBear.Plugin.IntroSkipper"); + // Save the modified XML document + xmlDoc.Save(filePath); + } } catch (XmlException ex) {