delete broken xml files
There is no other way to recover from this state. If the cache still exists, rebuilding the files shouldn't take long.
This commit is contained in:
parent
68582ede98
commit
9974e840bb
@ -52,6 +52,8 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper
|
||||
public static void MigrateXML(string filePath)
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Load the XML document
|
||||
XmlDocument xmlDoc = new XmlDocument();
|
||||
@ -59,7 +61,7 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper
|
||||
|
||||
ArgumentNullException.ThrowIfNull(xmlDoc.DocumentElement);
|
||||
|
||||
// check that the file has not already been migrated
|
||||
// Check that the file has not already been migrated
|
||||
if (xmlDoc.DocumentElement.HasAttribute("xmlns:xsi"))
|
||||
{
|
||||
xmlDoc.DocumentElement.RemoveAttribute("xmlns:xsi");
|
||||
@ -71,6 +73,13 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper
|
||||
xmlDoc.Save(filePath);
|
||||
}
|
||||
}
|
||||
catch (XmlException ex)
|
||||
{
|
||||
Console.WriteLine($"Error deserializing XML: {ex.Message}");
|
||||
File.Delete(filePath);
|
||||
Console.WriteLine($"Deleting {filePath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user