private void InitializeCustomProcessors(AnonymizerConfigurationManager configurationManager)
        {
            var processors = _customProcessorFactory.GetType().GetField("_customProcessors", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).GetValue(_customProcessorFactory) as Dictionary <string, Type>;

            foreach (var processor in processors)
            {
                _processors[processor.Key.ToUpperInvariant()] = _customProcessorFactory.CreateProcessor(processor.Key, configurationManager.GetParameterConfiguration().CustomSettings);
            }
        }
Пример #2
0
        public AnonymizerRule(string method, string description, IAnonymizerProcessorFactory processorFactory, JObject ruleSetting = null)
        {
            EnsureArg.IsNotNull(method, nameof(method));
            EnsureArg.IsNotNull(description, nameof(description));
            EnsureArg.IsNotNull(processorFactory, nameof(processorFactory));

            Description = description;
            processorFactory ??= new DicomProcessorFactory();
            _processor = processorFactory.CreateProcessor(method, ruleSetting);

            if (_processor == null)
            {
                throw new AnonymizerConfigurationException(DicomAnonymizationErrorCode.UnsupportedAnonymizationRule, $"Anonymization method '{method}' is not supported.");
            }
        }