undo namespace change for DataContract and migrate already changed xml files

This commit is contained in:
Kilian von Pflugk 2024-09-01 18:34:25 +02:00
parent 2f9471ad01
commit 7860910f3c
2 changed files with 9 additions and 1 deletions

View File

@ -9,7 +9,7 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper.Data;
/// Result of fingerprinting and analyzing two episodes in a season. /// Result of fingerprinting and analyzing two episodes in a season.
/// All times are measured in seconds relative to the beginning of the media file. /// All times are measured in seconds relative to the beginning of the media file.
/// </summary> /// </summary>
[DataContract] [DataContract(Namespace = "http://schemas.datacontract.org/2004/07/ConfusedPolarBear.Plugin.IntroSkipper")]
public class Intro public class Intro
{ {
/// <summary> /// <summary>

View File

@ -73,6 +73,14 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper
// Save the modified XML document // Save the modified XML document
xmlDoc.Save(filePath); 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) catch (XmlException ex)
{ {