public int CompareTo(CachedSettingValue other)
 {
     if (IsStringValue)
     {
         return(ValueStr.CompareTo(other.ValueStr));
     }
     else
     {
         return(Value.CompareTo(other.Value));
     }
 }
 public override string ToString()
 {
     if (Value > MaxValue)
     {
         return(MaxValueStr);
     }
     else if ((Value < MinValue) && (ValueStr != null) && ValueStr.ToUpper().Contains('E'))
     {
         return(MinValueStr);
     }
     else if (ValueStr != null)
     {
         return(ValueStr);
     }
     else
     {
         return(IsExponential ? _value.Value.ToString("0.###E-0#", NumberParser.EnglishFormat)
                                                                  : _value.Value.ToString("G", NumberParser.EnglishFormat));
     }
 }
        public override void Initialize()
        {
            base.Initialize();

            if (UserExercises == null)
            {
                UserExercises = new ConcurrentDictionary <string, InputExercise>(Environment.ProcessorCount * 2, 32);
            }

            //Split inputs by what's in the value string
            if (string.IsNullOrEmpty(ValueStr) == false)
            {
                InvalidExerciseInputNames = ValueStr.Split(SPLIT_CHAR, StringSplitOptions.RemoveEmptyEntries);

                //Trim whitespace
                for (int i = 0; i < InvalidExerciseInputNames.Length; i++)
                {
                    InvalidExerciseInputNames[i] = InvalidExerciseInputNames[i].Trim();
                }
            }
        }
        public override void ExecuteCommand(EvtChatCommandArgs args)
        {
            //Values are separated by the pipe character, '|'
            //Replace "{name}" with the user's name

            string userName = args.Command.ChatMessage.Username;

            //Allow inspiring another user
            List <string> arguments = args.Command.ArgumentsAsList;

            if (arguments.Count == 1)
            {
                //Check if the name is in the database
                User user = DataHelper.GetUser(arguments[0]);
                if (user != null)
                {
                    userName = user.Name;
                }
            }

            string[] inspirationArray = DefaultInspiration;

            if (string.IsNullOrEmpty(ValueStr) == false)
            {
                string[] newInspirationArray = ValueStr.Split(SPLIT_CHAR, StringSplitOptions.RemoveEmptyEntries);

                //Use the array from the values if there are elements
                if (newInspirationArray.Length > 0)
                {
                    inspirationArray = newInspirationArray;
                }
            }

            int    randInspiration = Rand.Next(0, inspirationArray.Length);
            string inspirationMsg  = inspirationArray[randInspiration];

            string message = inspirationMsg.Replace(NAME_REPLACE, userName);

            QueueMessage(message);
        }