private DapSource FindDeviceSource(IDevice device) { foreach (TypeExtensionNode node in supported_dap_types) { try { DapSource source = (DapSource)node.CreateInstance(); source.DeviceInitialize(device, false); source.LoadDeviceContents(); source.AddinId = node.Addin.Id; return(source); } catch (InvalidDeviceStateException) { Log.WarningFormat( "Dap.DapService: invalid state, mapping potential source for {0}", device.Name ); DapSource source = new PotentialSource(this, node, device); return(source); } catch (InvalidDeviceException) { } catch (InvalidCastException e) { Log.Warning("Extension is not a DapSource as required", e); } catch (Exception e) { Log.Error(e); } } return(null); }
private void OnHardwareDeviceChanged(object o, DeviceChangedEventArgs args) { DapSource source; if (!sources.TryGetValue(args.Device.Uuid, out source)) { MapDevice(args.Device); return; } PotentialSource potential = source as PotentialSource; if (potential != null) { potential.TryInitialize(); } }
private DapSource FindDeviceSource(IDevice device) { foreach (TypeExtensionNode node in supported_dap_types) { try { DapSource source = (DapSource)node.CreateInstance (); source.DeviceInitialize (device, false); source.LoadDeviceContents (); source.AddinId = node.Addin.Id; return source; } catch (InvalidDeviceStateException) { Log.WarningFormat ( "Dap.DapService: invalid state, mapping potential source for {0}", device.Name ); DapSource source = new PotentialSource (this, node, device); return source; } catch (InvalidDeviceException) { } catch (InvalidCastException e) { Log.Warning ("Extension is not a DapSource as required", e); } catch (Exception e) { Log.Error (e); } } return null; }