public byte[] GetIPData() { if (this.canDNS || !this.dev.IsNewVersion) { return(Encoding.ASCII.GetBytes(this.ip)); } int interIp = FrameClass.getInterIP(IPAddress.Parse(this.ip)); return(new byte[4] { (byte)(interIp >> 24), (byte)(interIp >> 16), (byte)(interIp >> 8), (byte)interIp }); }
private void createCommand() { this.frame[1] = this.identifier; ushort num1 = (ushort)4; switch (this.commType) { case CommunicationTypes.UDP: this.frame[0] = (byte)((uint)this.commandOrResponse + (uint)this.controlType * 2U); break; case CommunicationTypes.Broadcast: int interIp = FrameClass.getInterIP(this.ipAddr); byte[] numArray1 = this.frame; int index1 = (int)num1; int num2 = 1; ushort num3 = (ushort)(index1 + num2); int num4 = (int)(byte)(interIp >> 24); numArray1[index1] = (byte)num4; byte[] numArray2 = this.frame; int index2 = (int)num3; int num5 = 1; ushort num6 = (ushort)(index2 + num5); int num7 = (int)(byte)(interIp >> 16); numArray2[index2] = (byte)num7; byte[] numArray3 = this.frame; int index3 = (int)num6; int num8 = 1; ushort num9 = (ushort)(index3 + num8); int num10 = (int)(byte)(interIp >> 8); numArray3[index3] = (byte)num10; byte[] numArray4 = this.frame; int index4 = (int)num9; int num11 = 1; num1 = (ushort)(index4 + num11); int num12 = (int)(byte)interIp; numArray4[index4] = (byte)num12; this.frame[0] = (byte)((int)this.commandOrResponse + (int)this.controlType * 2 + 128); break; default: return; } if (this.optionList != null) { for (int index5 = 0; index5 < this.optionList.Count; ++index5) { if (this.optionList[index5].Option != null) { Array.Copy((Array)this.optionList[index5].Option, 0, (Array)this.frame, (int)num1, (int)this.optionList[index5].Length); } num1 += (ushort)this.optionList[index5].Length; } } this.frame[2] = (byte)Math.Floor((double)this.length / 256.0); this.frame[3] = (byte)((uint)this.length % 256U); if (this.frame.Length != (int)this.length) { Program.ShowMessage("Command字节数组编码,装配有误,请调试代码!", true); } else { if ((int)this.maxLength <= (int)byte.MaxValue) { return; } Program.ShowMessage("Command字节数组编码,装配超长,请调试代码!", true); } }