mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-06 08:16:19 +00:00
refactor: Tidying
This commit is contained in:
@@ -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()
|
||||
{
|
||||
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()
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,9 +396,8 @@ namespace ICD.Common.Utils.Xml
|
||||
[PublicAPI]
|
||||
public static bool ReadChildElementContentAsBoolean(string xml, string childElement)
|
||||
{
|
||||
// IcdXmlReader.ReadElementContentAsBoolean() is too case sensitive
|
||||
string output = ReadChildElementContentAsString(xml, childElement);
|
||||
return bool.Parse(output);
|
||||
using (IcdXmlReader reader = GetChildElement(xml, childElement))
|
||||
return reader.ReadElementContentAsBoolean();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user