Ryujinx-GtkSharp/generator/XmlElementExtensions.cs
Bertrand Lorentz d35ef48f86 generator: Add a XmlElement.GetAttributeAsBoolean extension method
This will make it easier to correctly handle attributes that contain a
boolean value.
2012-10-21 18:21:54 +02:00

21 lines
361 B
C#

using System;
using System.Xml;
namespace GtkSharp.Generation
{
public static class XmlElementExtensions
{
public static bool GetAttributeAsBoolean (this XmlElement elt, string name)
{
string value = elt.GetAttribute (name);
if (String.IsNullOrEmpty (value)) {
return false;
} else {
return XmlConvert.ToBoolean (value);
}
}
}
}