예제 #1
0
        public override void LoadParameterData(byte[] parameterData)
        {
            this.Flags          = (PhoneFlags)parameterData[0];
            this.NumberingFlags = (NAIFlags)parameterData[1];

            this.Number = IsupUtility.UnReverseNumber(parameterData, 2, this.Flags.HasFlag(PhoneFlags.IsOdd));
        }
예제 #2
0
        public override byte[] GetParameterData()
        {
            if (string.IsNullOrWhiteSpace(this.Number))
            {
                throw new InvalidOperationException("Cant serialize an empty called number");
            }

            var hexData = IsupUtility.GetReversedNumber(this.Number).ToArray();

            this.PointerToOptionalParameter = (byte)(hexData.Length + this.PointerToParameter + 2);
            var isEven = (this.Number.Length % 2) == 0;

            this.Flags |= isEven ? PhoneFlags.IsEven : PhoneFlags.IsOdd;

            return(new[] { (byte)this.Flags, (byte)this.NumberingFlags }.Concat(hexData).ToArray());
        }
예제 #3
0
        public override byte[] GetParameterData()
        {
            if (string.IsNullOrWhiteSpace(this.Number))
            {
                throw new InvalidOperationException("number must be valid for use with IsupPhoneNumberParameter");
            }

            var hexData = IsupUtility.GetReversedNumber(this.Number).ToArray();
            var isEven  = (this.Number.Length % 2) == 0;

            this.Flags           = isEven ? PhoneFlags.IsEven : PhoneFlags.IsOdd;
            this.Flags          |= PhoneFlags.NAINationalNumber;
            this.NumberingFlags |= NAIFlags.Isdn;

            return(new[] { (byte)this.Flags, (byte)this.NumberingFlags }.Concat(hexData).ToArray());
        }