WarTornLands.Infrastructure.XMLParser.ValueOfProperty C# (CSharp) Method

ValueOfProperty() public static method

Searches a propertie structure for a specified propertie.
public static ValueOfProperty ( DataRow data, string propertyName ) : string
data System.Data.DataRow The data.
propertyName string Name of the property.
return string
        public static string ValueOfProperty(DataRow data, string propertyName)
        {
            foreach (DataRow property in data.GetChildRows("properties_property"))
            {
                if (property["name"].ToString().Equals(propertyName))
                {
                    if (property["name"].ToString().Equals("master"))
                    {
                        if (property["value"].ToString().Equals("1"))
                            return "true";
                        if (property["value"].ToString().Equals("0"))
                            return "false";
                    }
                    return property["value"].ToString();
                }
            }

            throw new PropertyNotFoundException(propertyName);
        }