Пример #1
0
 protected void UnregisterInputType(string dataType)
 {
     lock (inputTypeLock)
     {
         if (!inputTypes.Remove(dataType))
         {
             return;
         }
     }
     InputTypeRemoved?.Invoke(this, new InputTypeRegistrationEventArgs(dataType));
 }
Пример #2
0
        private void OnProcessorInputTypeRemoved(object sender, InputTypeRegistrationEventArgs e)
        {
            var processor = (IProcessor)sender;
            var inputType = e.DataType;

            if (!typeMap.TryGetValue(inputType, out var typeProcessors))
            {
                return;
            }
            lock (typeMapListLock)
            {
                if (typeProcessors.Remove(processor))
                {
                    if (!typeProcessors.Any())
                    {
                        typeMap.TryRemove(inputType, out _);
                        InputTypeRemoved?.Invoke(this, new InputTypeRegistrationEventArgs(inputType));
                    }
                }
            }
        }