mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 12:45:01 +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()
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user