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; |
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
| 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
| 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
| 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
| static void SerialPort_ErrorReceived(object sender, SerialErrorReceivedEventArgs e) | |
| { | |
| Console.WriteLine($"Erro do sistema serial {e.ToString()}"); | |
| } |
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 void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) | |
| { | |
| Console.WriteLine($"Serial recebido"); | |
| string RxString = _serialPort.ReadExisting(); | |
| string SerialID; | |
| if (RxString.IndexOf("\r\n") > -1 || RxString.IndexOf("|") > -1) | |
| { | |
| SerialID = RxString.Replace("\r\n", "").Replace("|", ""); | |
| Console.WriteLine($"Serial: {SerialID}"); |
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
| internal class HardwareInfo | |
| { | |
| public string PortName { get; internal set; } | |
| public string Description { get; internal set; } | |
| public string SystemName { get; internal set; } | |
| public override string ToString() { | |
| return $" SystemName: {SystemName}\r\n Description:{Description}\r\n PortName:{PortName}"; | |
| } |
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
| { | |
| "require": { | |
| "monolog/monolog": "2.1.*", | |
| "craos/pgdump": "0.1.0" | |
| } | |
| } |
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
| UploadImagens(Conteudo) { | |
| return new Promise((resolve) => { | |
| fetch(Conteudo) | |
| .then(res => res.blob()) | |
| .then(res => { | |
| let fd = new FormData(); | |
| fd.append("blob", res, `${''.uuid()}.${Conteudo.substring("data:image/".length, Conteudo.indexOf(";base64"))}`); | |
| fetch(this.upload, { |
OlderNewer