Beispiel #1
0
 private static Value ReadBooleanArray(string line, int lineNum, List <bool> boolArray,
                                       Action <int, string> warn)
 {
     boolArray.Clear();
     while (!string.IsNullOrEmpty(line))
     {
         string[] spl = line.Split(new[] { ',' }, 2);
         line = spl.Length < 2 ? string.Empty : spl[1];
         string strTok = spl[0].Trim(' ', '\t');
         if (strTok == "true")
         {
             boolArray.Add(true);
         }
         else if (strTok == "false")
         {
             boolArray.Add(false);
         }
         else
         {
             warn?.Invoke(lineNum, "unrecognized boolean value, not 'true' or 'false'");
             return(null);
         }
     }
     return(Value.MakeBooleanArray(boolArray.ToArray()));
 }
Beispiel #2
0
        /// <summary>
        /// Sets an entry value in the table if it does not exist.
        /// </summary>
        /// <param name="name">The entry name</param>
        /// <param name="value">The value to set</param>
        /// <returns>False if the type does not match existing value</returns>
        public static bool SetDefaultEntryBooleanArray(string name, IList <bool> value)
        {
#if CORE
            return(CoreMethods.SetDefaultEntryBooleanArray(name, value));
#else
            return(Storage.Instance.SetDefaultEntryValue(name, Value.MakeBooleanArray(value)));
#endif
        }
Beispiel #3
0
        /// <summary>
        /// Sets an entry value
        /// </summary>
        /// <remarks>If the type of the new value differs from the type currently
        /// stored and the force parameter is false (default), returns error and
        /// does not update value. If force is true, the value type in the
        /// table is changed</remarks>
        /// <param name="name">The entry name</param>
        /// <param name="value">The value to set</param>
        /// <param name="force">True to force an update even if types are different</param>
        /// <returns>True on success, otherwise false</returns>
        public static bool SetEntryBooleanArray(string name, IList <bool> value, bool force = false)
        {
#if CORE
            return(CoreMethods.SetEntryBooleanArray(name, value, force));
#else
            if (force)
            {
                Storage.Instance.SetEntryTypeValue(name, Value.MakeBooleanArray(value));
                return(true);
            }
            return(Storage.Instance.SetEntryValue(name, Value.MakeBooleanArray(value)));
#endif
        }