Uart_Net/Form1.cs

(开头部分) 47KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;
using System.Text.RegularExpressions;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Drawing.Drawing2D;

namespace Uart_Net
{
    public partial class Form1 : Form
    {
        bool Seriallistening = false;

        UInt64 Srx = 0, Stx = 0, Nrx = 0, Ntx = 0;
        private byte[] SerialDataBuf = new byte[1024];
        private byte[] NetDataBuf = new byte[1024];
        private StringBuilder Serialbuilder = new StringBuilder();//数据类型(编码方式)转换构造器
        private StringBuilder Netbuilder = new StringBuilder();//数据类型(编码方式)转换构造器
        SerialPort Serialport = new SerialPort();
        TcpListener NetServer;
        private List<Socket> NetClients = new List<Socket>(6);
        Socket NetClient;
        UdpClient NetLocalUdp;

        private byte[] SerialAutoSendBuf;
        private byte[] NetAutoSendBuf;

        int UIMode = 1;
  
        
        bool NetServerExit = false;
        int NetCurrentMode = 0;
        EndPoint NetCurEP = null;


        public Form1()
        {
            InitializeComponent();

            SerialBaudBox.SelectedIndex = 3;
            foreach (string s in System.IO.Ports.SerialPort.GetPortNames())
            {
                SerialPortBox.Items.Add(s);
            }
            if (SerialPortBox.Items.Count != 0)
                SerialPortBox.SelectedIndex = 0;
            else
                SerialInfo.Text = "没有可用串口";
            Control.CheckForIllegalCrossThreadCalls = false;    //这个类中我们不检查跨线程的调用是否合法(因为.net 2.0以后加强了安全机制,,不允许在winform中直接跨线程访问控件的属性)
            Serialport.DataReceived += new SerialDataReceivedEventHandler(SerialDataReceived);
后面还有 1307 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。