Beispiel #1
0
        public Form1()
        {
            InitializeComponent();
            comboBoxSerialPorts.Items.AddRange(SerialPort.GetPortNames());

            uART_MsgComposer.OnFrameReceived += UART_MsgComposer_OnFrameReceived;

            ProcessBytes processBytes = new ProcessBytes();

            processBytes.UartBuffer       = uartBuffer;
            processBytes.UART_MsgComposer = uART_MsgComposer;
            processBytes.StartThread();
        }
Beispiel #2
0
    /// <summary>
    /// 创建标识。
    /// </summary>
    /// <param name="ticks">给定的时间刻度。</param>
    /// <param name="increment">给定的增量。</param>
    /// <returns>返回 16 进制字符串。</returns>
    public virtual string CreateId(int ticks, int increment)
    {
        IncrementBytes = BitConverter.GetBytes(increment);
        Increment      = increment;

        var buffer    = new byte[12];
        var copyIndex = 0;

        var ticksBytes = BitConverter.GetBytes(ticks);

        Array.Reverse(ticksBytes);
        Array.Copy(ticksBytes, 0, buffer, copyIndex, 4);

        copyIndex += 4;
        Array.Copy(MachineBytes, 0, buffer, copyIndex, 3);

        copyIndex += 3;
        Array.Copy(ProcessBytes.Reverse().ToArray(), 2, buffer, copyIndex, 2);

        copyIndex += 2;
        Array.Copy(IncrementBytes.Reverse().ToArray(), 1, buffer, copyIndex, 3);

        return(buffer.AsHexString());
    }
 public void Serialize(IPAddress IP, int Port, int Backlog, int SupportedAmount, ProcessBytes ByteProcessor)
 {
     this.ConstructSocket(IP, Port, Backlog);
     this.ConstructPooling(SupportedAmount);
     this.ByteProcessor = ByteProcessor;
 }
Beispiel #4
0
 public void Serialize(IPAddress IP, int Port, int Backlog, int SupportedAmount, ProcessBytes ByteProcessor)
 {
     this.ConstructSocket(IP, Port, Backlog);
     this.ConstructPooling(SupportedAmount);
     this.ByteProcessor = ByteProcessor;
 }