/// <summary> /// Validates the tag options /// </summary> /// <param name="tagOptions">Tag options.</param> protected override void ValidateOptions(TagOption[] tagOptions) { if (tagOptions.Distinct().Count() != tagOptions.Length) throw new ArgumentException("All option values must be different!"); if (tagOptions.FirstOrDefault(o => !(o is BBCodeOption)) != null) throw new ArgumentException("All option values must be of type BBCodeOption!"); if (tagOptions.FirstOrDefault(o => (o as BBCodeOption).IsCoverAllOptions) != null && tagOptions.FirstOrDefault(o => (o as BBCodeOption).IsCoverSpecificOption) != null) throw new ArgumentException("One of your rules covers some of the others!"); }
/// <summary> /// Validates the given options for converting the current html tag to bbcode. /// </summary> /// <param name="tagOptions">The different possible options</param> protected override void ValidateOptions(TagOption[] tagOptions) { if (tagOptions.Distinct().Count() != tagOptions.Length) throw new ArgumentException("All option values must be unique!"); if (tagOptions.FirstOrDefault(o => !(o is HtmlOption)) != null) throw new ArgumentException("All option values must be of type HtmlOption!"); }