/// <summary> /// Creates a new instance of a hardware interface from a name /// returned from the Available dictionary. /// </summary> public static MidiHardwareInterface CreateInstance(string name, MappedMidiDevice mapping) { MidiHardwareInterface mhi = null; if (_availableInstances.TryGetValue(name, out mhi)) { return(CreateInstance(mhi.GetType(), mapping)); } return(null); }
/// <summary> /// Get the list of available subclasses /// </summary> static MidiHardwareTypes() { var interfaces = (from assemby in AppDomain.CurrentDomain.GetAssemblies() from type in assemby.GetTypes() where type.IsSubclassOf(typeof(MidiHardwareInterface)) select type ).ToArray(); Available = new List <string>(); _availableInstances = new Dictionary <string, MidiHardwareInterface>(); foreach (var type in interfaces) { MidiHardwareInterface instance = CreateInstance(type); if (instance != null) { Available.Add(instance.Name); _availableInstances.Add(instance.Name, instance); } } }