Beispiel #1
0
        /// <summary>
        /// Get a string value for a property.
        /// This method is convenient but inefficient.  It should be used
        /// infrequently(i.e. for initializing, loading, saving, etc.),
        /// not in the main loop.If you need to get a value frequently,
        /// it is better to look up the node itself using GetNode and then
        /// use the node's getStringValue() method, to avoid the lookup overhead.
        /// </summary>
        /// <param name="name">The property name.</param>
        /// <param name="defaultValue">The default value to return if the property does not exist.</param>
        /// <returns>The property's value as a string, or the default value provided.</returns>
        public string GetString(string name, string defaultValue = "")
        {
            PropertyNode node = GetNode(name);

            return(node == null ? defaultValue : node.GetString());
        }
Beispiel #2
0
        /// <summary>
        /// Get a double value for a property.
        /// This method is convenient but inefficient.  It should be used
        /// infrequently(i.e. for initializing, loading, saving, etc.),
        /// not in the main loop.If you need to get a value frequently,
        /// it is better to look up the node itself using GetNode and then
        /// use the node's getDoubleValue() method, to avoid the lookup overhead.
        /// </summary>
        /// <param name="name">The property name.</param>
        /// <param name="defaultValue">The default value to return if the property does not exist.</param>
        /// <returns>The property's value as a double, or the default value provided.</returns>
        public double GetDouble(string name, double defaultValue = 0.0)
        {
            PropertyNode node = GetNode(name);

            return(node == null ? defaultValue : node.GetDouble());
        }
Beispiel #3
0
        /// <summary>
        /// Get a float value for a property.
        /// This method is convenient but inefficient.  It should be used
        /// infrequently(i.e. for initializing, loading, saving, etc.),
        /// not in the main loop.If you need to get a value frequently,
        /// it is better to look up the node itself using GetNode and then
        /// use the node's getFloatValue() method, to avoid the lookup overhead.
        /// </summary>
        /// <param name="name">The property name.</param>
        /// <param name="defaultValue">The default value to return if the property does not exist.</param>
        /// <returns>The property's value as a float, or the default value provided.</returns>
        public float GetFloat(string name, float defaultValue = 0.0f)
        {
            PropertyNode node = GetNode(name);

            return(node == null ? defaultValue : node.GetSingle());
        }
Beispiel #4
0
        /// <summary>
        /// Get a long value for a property.
        /// This method is convenient but inefficient.  It should be used
        /// infrequently(i.e. for initializing, loading, saving, etc.),
        /// not in the main loop.If you need to get a value frequently,
        /// it is better to look up the node itself using GetNode and then
        /// use the node's getLongValue() method, to avoid the lookup overhead.
        /// </summary>
        /// <param name="name">The property name.</param>
        /// <param name="defaultValue">The default value to return if the property does not exist.</param>
        /// <returns>The property's value as a long, or the default value provided.</returns>
        public long GetLong(string name, long defaultValue = 0L)
        {
            PropertyNode node = GetNode(name);

            return(node == null ? defaultValue : node.GetInt64());
        }
Beispiel #5
0
        /// <summary>
        /// Get a int value for a property.
        /// This method is convenient but inefficient.  It should be used
        /// infrequently(i.e. for initializing, loading, saving, etc.),
        /// not in the main loop.If you need to get a value frequently,
        /// it is better to look up the node itself using GetNode and then
        /// use the node's getIntValue() method, to avoid the lookup overhead.
        /// </summary>
        /// <param name="name">The property name.</param>
        /// <param name="defaultValue">The default value to return if the property does not exist.</param>
        /// <returns>The property's value as a int, or the default value provided.</returns>
        public int GetInt(string name, int defaultValue = 0)
        {
            PropertyNode node = GetNode(name);

            return(node == null ? defaultValue : node.GetInt32());
        }
Beispiel #6
0
        /// <summary>
        /// Get a bool value for a property.
        /// This method is convenient but inefficient.  It should be used
        /// infrequently(i.e. for initializing, loading, saving, etc.),
        /// not in the main loop.If you need to get a value frequently,
        /// it is better to look up the node itself using GetNode and then
        /// use the node's getBoolValue() method, to avoid the lookup overhead.
        /// </summary>
        /// <param name="name">The property name.</param>
        /// <param name="defaultValue">The default value to return if the property does not exist.</param>
        /// <returns>The property's value as a bool, or the default value provided.</returns>
        public bool GetBool(string name, bool defaultValue = false)
        {
            PropertyNode node = GetNode(name);

            return(node == null ? defaultValue : node.GetBool());
        }