示例#1
0
        /// <summary>
        /// Creates an Unsuccess address.  This will trim down the address given to
        /// it for use in future operations.
        /// </summary>
        /// <param name="address">The bytes of the response.</param>
        public UnsuccessAddress(ref byte[] address)
        {
            DestinationAddressTon = (Pdu.TonType)address[0];
            DestinationAddressNpi = (Pdu.NpiType)address[1];
            DestinationAddress    = SmppStringUtil.GetCStringFromBody(ref address, 2);
            //convert error status to host order
            ErrorStatusCode = UnsignedNumConverter.SwapByteOrdering(
                BitConverter.ToUInt32(address, 0));
            //now we have to trim off four octets to account for the status code
            long length = address.Length - 4;

            byte[] newRemainder = new byte[length];
            Array.Copy(address, 4, newRemainder, 0, length);
            //and change the reference
            address      = newRemainder;
            newRemainder = null;
        }
示例#2
0
        /// <summary>
        /// Creates an DestinationAddress address.  This will trim down the address given to
        /// it for use in future operations.
        /// </summary>
        /// <param name="address">The bytes of the response.</param>
        public DestinationAddress(ref byte[] address)
        {
            if (address[0] == 0x01)
            {
                IsDistributionList = false;
            }
            else if (address[0] == 0x02)
            {
                IsDistributionList = true;
            }
            else
            {
                throw new ApplicationException("Unable to determine type of destination address");
            }

            if (!IsDistributionList)
            {
                DestinationAddressTon = (Pdu.TonType)address[1];
                DestinationAddressNpi = (Pdu.NpiType)address[2];
                DestAddress           = SmppStringUtil.GetCStringFromBody(ref address, 3);
//
//				long length = address.Length - 4;
//				byte[] newRemainder = new byte[length];
//				Array.Copy(address, 4, newRemainder, 0, length);
//				//and change the reference
//				address = newRemainder;
//				newRemainder = null;
            }
            else
            {
                DistributionList = SmppStringUtil.GetCStringFromBody(ref address, 1);
//
//				long length = address.Length - 4;
//				byte[] newRemainder = new byte[length];
//				Array.Copy(address, 4, newRemainder, 0, length);
//				//and change the reference
//				address = newRemainder;
//				newRemainder = null;
            }
        }