public void Add(DecodedMessage dm) { bool flag = this.Flag != dm.Flag || dm.PhoneNumber != this.PhoneNumber; if (flag) { throw new ArgumentException("不是本条的一部分"); } int index = dm.current; bool flag2 = this.li.Contains(index); if (!flag2) { this.SendTime = dm.SendTime; this.sd[index] = dm.sd[index]; } }
public DecodedMessage PDUDecoder(string strPDU) { int num = Convert.ToInt32(strPDU.Substring(0, 2), 16) * 2 + 2; this.serviceCenterAddress = strPDU.Substring(0, num); this.protocolDataUnitType = strPDU.Substring(num, 2); int num2 = Convert.ToInt32(strPDU.Substring(num + 2, 2), 16); bool flag = num2 % 2 == 1; if (flag) { num2++; } int length = num2 + 4; this.originatorAddress = strPDU.Substring(num + 2, length); this.dataCodingScheme = strPDU.Substring(num + length + 4, 2); this.serviceCenterTimeStamp = strPDU.Substring(num + length + 6, 14); this.userDataLenghth = strPDU.Substring(num + length + 20, 2); int num3 = Convert.ToInt32(this.userDataLenghth, 16) * 2; bool flag2 = (Convert.ToInt32(this.protocolDataUnitType, 16) & 64) != 0; DecodedMessage result; if (flag2) { bool flag3 = this.dataCodingScheme.Substring(1, 1) == "8"; if (flag3) { this.userDataLenghth = ((int)(Convert.ToInt16(strPDU.Substring(num + length + 20, 2), 16) - 6)).ToString("X2"); this.userData = strPDU.Substring(num + length + 22 + 12); result = new DecodedMessage(strPDU.Substring(num + length + 22 + 8, 4) + strPDU.Substring(num + length + 22 + 6, 2), this.ServiceCenterAddress, string.Concat(new string[] { this.ServiceCenterTimeStamp.Substring(0, 4), "-", this.ServiceCenterTimeStamp.Substring(4, 2), "-", this.ServiceCenterTimeStamp.Substring(6, 2), " ", this.ServiceCenterTimeStamp.Substring(8, 2), ":", this.ServiceCenterTimeStamp.Substring(10, 2), ":", this.ServiceCenterTimeStamp.Substring(12, 2) }), this.OriginatorAddress, this.UserData); } else { this.userData = strPDU.Substring(num + length + 22 + 12 + 2); char ch = (char)((uint)Convert.ToByte(strPDU.Substring(num + length + 22 + 12, 2), 16) >> 1); result = new DecodedMessage(strPDU.Substring(num + length + 22 + 8, 4) + strPDU.Substring(num + length + 22 + 6, 2), this.ServiceCenterAddress, string.Concat(new string[] { this.ServiceCenterTimeStamp.Substring(0, 4), "-", this.ServiceCenterTimeStamp.Substring(4, 2), "-", this.ServiceCenterTimeStamp.Substring(6, 2), " ", this.ServiceCenterTimeStamp.Substring(8, 2), ":", this.ServiceCenterTimeStamp.Substring(10, 2), ":", this.ServiceCenterTimeStamp.Substring(12, 2) }), this.OriginatorAddress, ch.ToString() + this.UserData); } } else { this.userData = strPDU.Substring(num + length + 22); result = new DecodedMessage("010100", this.ServiceCenterAddress, string.Concat(new string[] { this.ServiceCenterTimeStamp.Substring(0, 4), "-", this.ServiceCenterTimeStamp.Substring(4, 2), "-", this.ServiceCenterTimeStamp.Substring(6, 2), " ", this.ServiceCenterTimeStamp.Substring(8, 2), ":", this.ServiceCenterTimeStamp.Substring(10, 2), ":", this.ServiceCenterTimeStamp.Substring(12, 2) }), this.OriginatorAddress, this.UserData); } return(result); }