public CommPortInfo(CommPortInfo other) : this(msclPINVOKE.new_CommPortInfo__SWIG_1(CommPortInfo.getCPtr(other)), true) { if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
public static List <CommPortInfo> EnumCommPorts() { List <CommPortInfo> commPorts = new List <CommPortInfo>(); try { ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_PnPEntity WHERE ClassGuid='{4d36e978-e325-11ce-bfc1-08002be10318}'"); foreach (ManagementObject queryObj in searcher.Get()) { CommPortInfo deviceObj = new CommPortInfo(queryObj); if (deviceObj.PortName.StartsWith("LPT")) { continue; } Logger.Trace("Found a comm. port: " + deviceObj.PortName); commPorts.Add(deviceObj); } } catch (Exception e) { Logger.Trace("Exception while listing the comm. ports"); Logger.Trace(e.Message); } return(commPorts); }
public CommPortInfoEnumerator(CommPortInfo collection) { collectionRef = collection; currentIndex = -1; currentObject = null; currentSize = collectionRef.Count; }
public void SetRange(int index, CommPortInfo values) { msclPINVOKE.CommPortInfo_SetRange(swigCPtr, index, CommPortInfo.getCPtr(values)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
public CommPortInfo getCommPortInfo() { CommPortInfo ret = new CommPortInfo(msclPINVOKE.MipNodeFeatures_getCommPortInfo(swigCPtr), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static CommPortInfo Repeat(DeviceCommPort value, int count) { global::System.IntPtr cPtr = msclPINVOKE.CommPortInfo_Repeat(DeviceCommPort.getCPtr(value), count); CommPortInfo ret = (cPtr == global::System.IntPtr.Zero) ? null : new CommPortInfo(cPtr, true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public CommPortInfo GetRange(int index, int count) { global::System.IntPtr cPtr = msclPINVOKE.CommPortInfo_GetRange(swigCPtr, index, count); CommPortInfo ret = (cPtr == global::System.IntPtr.Zero) ? null : new CommPortInfo(cPtr, true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static List<CommPortInfo> EnumCommPorts() { List<CommPortInfo> commPorts = new List<CommPortInfo>(); try { ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_PnPEntity WHERE ClassGuid='{4d36e978-e325-11ce-bfc1-08002be10318}'"); foreach (ManagementObject queryObj in searcher.Get()) { CommPortInfo deviceObj = new CommPortInfo(queryObj); if (deviceObj.PortName.StartsWith("LPT")) continue; Logger.Trace("Found a comm. port: " + deviceObj.PortName); commPorts.Add(deviceObj); } } catch (Exception e) { Logger.Trace("Exception while listing the comm. ports"); Logger.Trace(e.Message); } return commPorts; }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CommPortInfo obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }