public void Initialize() { lock (subDeviceLock) { if (initialized) { return; } initialized = true; } string path = Assembly.GetExecutingAssembly().Location; path = path.Substring(0, path.LastIndexOfAny(new char[] { Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar })); foreach (string file in Directory.EnumerateFiles(path, "CorsairLinkPlusPlus.Driver.*.dll")) { Assembly driver = Assembly.LoadFile(file); Type iRootDevice = typeof(IRootDevice); foreach (Type t in driver.GetExportedTypes()) { if (!t.IsAbstract && !t.IsInterface && iRootDevice.IsAssignableFrom(t)) { try { IRootDevice rootDevice = (IRootDevice)t.GetConstructor(new Type[0]).Invoke(null); rootDevice.Initialize(); rootDevices.Add(rootDevice); } catch (Exception e) { Console.Error.WriteLine("Could not load driver " + driver.FullName + ": " + e.Message); } } } } }
public ServoDevice(byte ID, IRootDevice root) { id = ID; rootDevice = root; }
public ThermometerDevice(byte ID, IRootDevice root) { id = ID; rootDevice = root; }
public NullDevice(byte ID, IRootDevice root) { id = ID; rootDevice = root; }
public LEDDevice(byte ID, IRootDevice root) { id = ID; rootDevice = root; }
public ButtonDevice(byte ID, IRootDevice root) { id = ID; rootDevice = root; }