예제 #1
0
        /// <summary>
        /// Sets or update a value in the ini file.
        /// </summary>
        /// <typeparam name="T">The type of value to return.</typeparam>
        /// <param name="section">The section the value belongs to.</param>
        /// <param name="key">The key to the value.</param>
        /// <param name="val">The value.</param>
        public void SetValue <T>(string section, string key, T val)
        {
            object oVal = val;

            if (typeof(T) == typeof(string))
            {
                WriteValue(section, key, (string)oVal);
            }
            else if (typeof(T) == typeof(bool))
            {
                WriteValue(section, key, HQTools.ValToString((bool)oVal));
            }
            else if (typeof(T) == typeof(int))
            {
                WriteValue(section, key, HQTools.ValToString((int)oVal));
            }
            else if (typeof(T) == typeof(float))
            {
                WriteValue(section, key, HQTools.ValToString((float)oVal));
            }
            else if (typeof(T) == typeof(double))
            {
                WriteValue(section, key, HQTools.ValToString((double)oVal));
            }
            else
            {
                WriteValue(section, key, val.ToString());
            }
        }
예제 #2
0
 /// <summary>
 /// Replaces all instance of "$KEY$" in a Lua script by value.
 /// </summary>
 /// <param name="lua">The Lua script.</param>
 /// <param name="key">The key to replace, without the dollar signs.</param>
 /// <param name="value">The value to replace the key with.</param>
 /// <param name="stringFormat">The string format string to use when converting the value to a string.</param>
 public static void ReplaceKey(ref string lua, string key, double value, string stringFormat = null)
 {
     ReplaceKey(ref lua, key, HQTools.ValToString(value, stringFormat));
 }
예제 #3
0
 /// <summary>
 /// Replaces all instance of "$KEY$" in a Lua script by value.
 /// </summary>
 /// <param name="lua">The Lua script.</param>
 /// <param name="key">The key to replace, without the dollar signs.</param>
 /// <param name="value">The value to replace the key with.</param>
 public static void ReplaceKey(ref string lua, string key, bool value)
 {
     ReplaceKey(ref lua, key, HQTools.ValToString(value).ToLowerInvariant());
 }
예제 #4
0
 /// <summary>
 /// Returns the MinMax value as a string.
 /// </summary>
 /// <param name="stringFormat">A format string.</param>
 /// <returns>A string</returns>
 public string ToString(string stringFormat)
 { return HQTools.ValToString(Min, stringFormat) + "," + HQTools.ValToString(Max, stringFormat); }
예제 #5
0
 public string ToString(string format)
 {
     return(HQTools.ValToString(X, format) + "," + HQTools.ValToString(Y, format));
 }
예제 #6
0
 public override string ToString()
 {
     return(HQTools.ValToString(X) + "," + HQTools.ValToString(Y));
 }