fCraft.Config.ReadBool C# (CSharp) Method

ReadBool() private static method

private static ReadBool ( XElement doc, string fieldName, bool _default ) : bool
doc XElement
fieldName string
_default bool
return bool
        private static bool ReadBool( XElement doc, string fieldName, bool _default ) {
            XElement element = doc.Element( fieldName );
            if( element != null ) {
                Logger.Log( "Config.ReadBool: " + fieldName + " = " + element.Value );
                return Boolean.Parse( element.Value );
            } else {
                Logger.Log( "Config.ReadBool: " + fieldName + " = " + _default + " (default)" );
                doc.Add( new XElement( fieldName, _default ) );
                return _default;
            }
        }
    }