public ValidationResult IsValid(T parameter) { var errorMessages = new List <string>(); var validationResult = new WordValidationResult(parameter.ToString()); if (string.IsNullOrEmpty(validationResult.Word)) { errorMessages.Add("Invalid: Word can't be empty"); } else if (validationResult.Word.Length != WordLenght) { errorMessages.Add($"Invalid: Word can be only {WordLenght} characters long"); } else if (SuppliedWords.Any(w => w == validationResult.Word)) { errorMessages.Add($"Invalid: Word '{validationResult.Word}' already supplied"); } else if (!WordList.Any(w => w == validationResult.Word)) { errorMessages.Add($"Invalid: Unable to find '{validationResult.Word}' in the Dictionary File"); } validationResult.ErrorMessages = errorMessages; return(validationResult); }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (WordList.Any()) { writer.WritePropertyName("wordList"); writer.WriteStartArray(); foreach (var item in WordList) { writer.WriteStringValue(item); } writer.WriteEndArray(); } else { writer.WriteNull("wordList"); } if (MinWordSize != null) { writer.WritePropertyName("minWordSize"); writer.WriteNumberValue(MinWordSize.Value); } if (MinSubwordSize != null) { writer.WritePropertyName("minSubwordSize"); writer.WriteNumberValue(MinSubwordSize.Value); } if (MaxSubwordSize != null) { writer.WritePropertyName("maxSubwordSize"); writer.WriteNumberValue(MaxSubwordSize.Value); } if (OnlyLongestMatch != null) { writer.WritePropertyName("onlyLongestMatch"); writer.WriteBooleanValue(OnlyLongestMatch.Value); } writer.WritePropertyName("@odata.type"); writer.WriteStringValue(ODataType); writer.WritePropertyName("name"); writer.WriteStringValue(Name); writer.WriteEndObject(); }
private static void OnMessage(Obj_AI_Base sender, ChatMessageEventArgs args) { if (!menu["BLOCKTEAM"].Cast <CheckBox>().CurrentValue) { return; } var ally = sender as AIHeroClient; if (!sender.IsMe && sender.IsAlly && WordList.Any(x => args.Message.ToLower().Contains(x))) { TeamToxicCount[ally.ChampionName]++; if (TeamToxicCount[ally.ChampionName] == 9) { Chat.Print(ally.ChampionName + " Will Get Muted If He Says Another Bad Word!"); } } }
private static void OnInput(ChatInputEventArgs args) { if (Disabled) { args.Process = false; Chat.Print("Your Chat Is Permanently Disabled!"); } var msg = args.Input; if (WordList.Any(x => msg.ToLower().Contains(x))) { args.Process = false; Chat.Print("Being Toxic Wont Help Your Team!"); } if (msg.Contains(".block ")) { args.Process = false; AddCommand(msg); } }
private bool CanSelectAll(object p) { return((WordList != null) && WordList.Any(e => !e.IsSelected)); }
private bool CanCopy(object p) { return((WordList != null) && WordList.Any(e => e.IsSelected)); }