xml空白符问题修复

This commit is contained in:
蓝点lilac
2021-05-15 05:06:55 +08:00
parent 2601aad8e9
commit 312bddb7f6
3 changed files with 5 additions and 5 deletions

View File

@@ -32,8 +32,8 @@ namespace ContextMenuManager.Controls
if(!File.Exists(xmlPath)) return;
this.AddItem(groupItem);
XmlDocument doc = new XmlDocument();
try { doc.LoadXml(File.ReadAllText(xmlPath, EncodingType.GetType(xmlPath))); }
catch { return; }
try { doc.LoadXml(File.ReadAllText(xmlPath, EncodingType.GetType(xmlPath)).Trim()); }
catch(Exception e) { MessageBoxEx.Show(e.Message); return; }
foreach(XmlNode xn in doc.DocumentElement.ChildNodes)
{
try

View File

@@ -512,7 +512,7 @@ namespace ContextMenuManager.Controls
private void LoadUwpModeItem(string xmlPath)
{
XmlDocument doc = new XmlDocument();
try { doc.LoadXml(File.ReadAllText(xmlPath, EncodingType.GetType(xmlPath))); }
try { doc.LoadXml(File.ReadAllText(xmlPath, EncodingType.GetType(xmlPath)).Trim()); }
catch { return; }
foreach(XmlElement sceneXE in doc.DocumentElement.ChildNodes)
{

View File

@@ -32,8 +32,8 @@ namespace ContextMenuManager.Controls
if(!File.Exists(xmlPath)) return;
this.AddItem(groupItem);
XmlDocument doc = new XmlDocument();
try { doc.LoadXml(File.ReadAllText(xmlPath, EncodingType.GetType(xmlPath))); }
catch { return; }
try { doc.LoadXml(File.ReadAllText(xmlPath, EncodingType.GetType(xmlPath)).Trim()); }
catch(Exception e) { MessageBoxEx.Show(e.Message); return; }
foreach(XmlElement groupXE in doc.DocumentElement.ChildNodes)
{
try