protected void RegisterInputType(string dataType) { lock (inputTypeLock) { if (inputTypes.Contains(dataType)) { return; } inputTypes.Add(dataType); } InputTypeAdded?.Invoke(this, new InputTypeRegistrationEventArgs(dataType)); }
private void OnProcessorInputTypeAdded(object sender, InputTypeRegistrationEventArgs e) { var processor = (IProcessor)sender; var inputType = e.DataType; if (typeMap.TryAdd(inputType, new List <IProcessor>())) { InputTypeAdded?.Invoke(this, new InputTypeRegistrationEventArgs(inputType)); } if (!typeMap.TryGetValue(inputType, out var typeProcessors)) { throw new Exception($"Expected type map to contain '{inputType}'"); } lock (typeMapListLock) { if (typeProcessors.Contains(processor)) { return; } typeProcessors.Add(processor); } }