refactor: Tidying

This commit is contained in:
Chris Cameron
2018-10-17 17:13:18 -04:00
parent 699c734389
commit e9063682ef
2 changed files with 22 additions and 16 deletions

View File

@@ -138,19 +138,6 @@ namespace ICD.Common.Utils.Xml
} }
} }
public string ReadElementContentAsString()
{
try
{
return m_Reader.ReadElementContentAsString();
}
catch (XmlException e)
{
string message = string.Format("Unable to read element '{0}' content as string", m_Reader.Name);
throw new IcdXmlException(message, e, e.LineNumber, e.LinePosition);
}
}
public string ReadOuterXml() public string ReadOuterXml()
{ {
try try
@@ -175,6 +162,19 @@ namespace ICD.Common.Utils.Xml
} }
} }
public string ReadElementContentAsString()
{
try
{
return m_Reader.ReadElementContentAsString();
}
catch (XmlException e)
{
string message = string.Format("Unable to read element '{0}' content as string", m_Reader.Name);
throw new IcdXmlException(message, e, e.LineNumber, e.LinePosition);
}
}
public long ReadElementContentAsLong() public long ReadElementContentAsLong()
{ {
try try
@@ -199,6 +199,13 @@ namespace ICD.Common.Utils.Xml
} }
} }
public bool ReadElementContentAsBoolean()
{
// ReadElementContentAsBoolean() is too case sensitive
string value = ReadElementContentAsString();
return bool.Parse(value);
}
#endregion #endregion
} }
} }

View File

@@ -396,9 +396,8 @@ namespace ICD.Common.Utils.Xml
[PublicAPI] [PublicAPI]
public static bool ReadChildElementContentAsBoolean(string xml, string childElement) public static bool ReadChildElementContentAsBoolean(string xml, string childElement)
{ {
// IcdXmlReader.ReadElementContentAsBoolean() is too case sensitive using (IcdXmlReader reader = GetChildElement(xml, childElement))
string output = ReadChildElementContentAsString(xml, childElement); return reader.ReadElementContentAsBoolean();
return bool.Parse(output);
} }
/// <summary> /// <summary>