private void SetTcpip() { if (!RegexBase.IsIPv4(txtTCPIP.Text.ToString().Trim())) { MessageStatus.Show("IP地址错误!", "IP Address Error!", (int)CommRtn.FAIL); return; } if (!RegexBase.IsIPv4(txtTCPMask.Text.ToString().Trim())) { MessageStatus.Show("子网掩码错误!", "Subnet Mask Error!", (int)CommRtn.FAIL); return; } if (!RegexBase.IsIPv4(txtTCPGateway.Text.ToString().Trim())) { MessageStatus.Show("网关地址错误!", "GateWay Error!", (int)CommRtn.FAIL); return; } if (!RegexBase.IsMac(txtTCPMac.Text.ToString().Trim())) { MessageStatus.Show("Mac地址错误!", "Mac Address Error!", (int)CommRtn.FAIL); return; } if (!RegexBase.IsIPv4(txtRemoteIP.Text.ToString().Trim())) { MessageStatus.Show("RemoteIP地址错误!", "RemoteIP Address Error!", (int)CommRtn.FAIL); return; } TcpipParameters newTemp = GetTcpipParaInfo(); if (!SystemPub.ADRcp.SendBytePkt(PassiveRcp.SetTcpip(SystemPub.ADRcp.Address, newTemp.ToArray()))) { } }