This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static ManagementObjectSearcher VniPnp() | |
| { | |
| ManagementScope connectionScope = new ManagementScope(); | |
| SelectQuery serialQuery = new SelectQuery("SELECT * FROM Win32_PnPEntity"); | |
| return new ManagementObjectSearcher(connectionScope, serialQuery); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foreach (ManagementObject item in searcher.Get()) | |
| { | |
| string Description = item["Description"]?.ToString(); | |
| string Name = item["Name"]?.ToString(); | |
| string SystemName = item["SystemName"]?.ToString(); | |
| if (Description != null && Name.Contains("(COM")) | |
| { | |
| if (Description.Contains("CH340") || Description.Contains("Arduino")) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ManagementObjectSearcher searcher = VniPnp(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static SerialPort _serialPort; | |
| /// <summary> | |
| /// Este sistema utiliza a entrada do windows system32 através da leitura em Win32_PnPEntity | |
| /// Ao fazer a leitura das informações o sistema irá filtrar por informações do fabricante | |
| /// </summary> | |
| /// <param name="args"></param> | |
| static void Main(string[] args) | |
| { | |
| _serialPort = new SerialPort |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO.Ports; | |
| using System.Management; |
NewerOlder