private void ProcessItemValidation([NotNull] XmlTextWriter output, [NotNull] ValidationWriter writer, [NotNull] ValidationAnalyzerOptions options, [NotNull] IEnumerable <Language> languages, [NotNull] Item item, [NotNull] ValidationManager.ItemValidationDescriptor itemValidationDescriptor) { Debug.ArgumentNotNull(output, nameof(output)); Debug.ArgumentNotNull(writer, nameof(writer)); Debug.ArgumentNotNull(options, nameof(options)); Debug.ArgumentNotNull(languages, nameof(languages)); Debug.ArgumentNotNull(item, nameof(item)); Debug.ArgumentNotNull(itemValidationDescriptor, nameof(itemValidationDescriptor)); if (options.InactiveValidations.Contains("[" + itemValidationDescriptor.Attribute.Name + "]")) { return; } if (!itemValidationDescriptor.Instance.CanCheck(options.ContextName, item)) { return; } if (itemValidationDescriptor.Attribute.ExecutePerLanguage) { foreach (var language in languages) { using (new LanguageSwitcher(language)) { ProcessItem(output, writer, itemValidationDescriptor, item); } } } else { ProcessItem(output, writer, itemValidationDescriptor, item); } }
private void ProcessItem([NotNull] XmlTextWriter output, [NotNull] ValidationWriter writer, [NotNull] ValidationManager.ItemValidationDescriptor descriptor, [NotNull] Item item) { Debug.ArgumentNotNull(output, nameof(output)); Debug.ArgumentNotNull(writer, nameof(writer)); Debug.ArgumentNotNull(descriptor, nameof(descriptor)); Debug.ArgumentNotNull(item, nameof(item)); try { writer.Clear(); descriptor.Instance.Check(writer, item); writer.Write(output, descriptor.Attribute.Category, descriptor.Attribute.Name); } catch (Exception ex) { Log.Error("Validations", ex, GetType()); } }