public PduSctsSegment(IPduProfileSettings settings) { if (settings == null) { throw new ArgumentNullException("Profile settings not specified."); } }
public PduScaSegment(IPduProfileSettings settings) { if (settings == null) { throw new ArgumentNullException("Profile settings not specified."); } if (settings.ServiceCenterAddress != null) { if (settings.ServiceCenterAddress.AddressType < 0 || settings.ServiceCenterAddress.AddressType > 255) { throw new ArgumentException("Address type out of range."); } if (settings.ServiceCenterAddress.AddressValue < 0) { throw new ArgumentException("Address value out of range."); } _type = settings.ServiceCenterAddress.AddressType.ToString("X2"); _addressValue = settings.ServiceCenterAddress.AddressValue; _address = settings.ServiceCenterAddress.AddressValue.ToBdcString(); _length = _address.OctetsCount() + 1; HasInternationalNumbering = settings.ServiceCenterAddress.AddressType == Constants.InternationalAddressType; } }
public IPduProfile CreateDefaultProfile(IPduProfileSettings settings, string name) { return(new PduDefaultProfile(settings) { Name = name }); }
private IPduProfileSettings loadProfileSettings(Stream jsonFile, Type profileType) { IPduProfileSettings result = null; try { var reader = new StreamReader(jsonFile); var profileText = reader.ReadToEnd(); var profileBytes = Encoding.UTF8.GetBytes(profileText); using (var profileStream = new MemoryStream(profileBytes)) { var deserializer = new DataContractJsonSerializer(profileType); var profileSettings = deserializer.ReadObject(profileStream); if (profileSettings is IPduProfileSettings) { result = profileSettings as IPduProfileSettings; } } } catch { } return(result); }
public PduReceiveHeaderSegment(IPduProfileSettings settings) : base(settings) { if (!settings.CanDeliver || GetMessageType() != MTI.Delivery) { throw new ArgumentException("Profile settings not valid."); } }
public PduSendHeaderSegment(IPduProfileSettings settings) : base(settings) { if (!settings.CanSubmit || GetMessageType() != MTI.Submit) { throw new ArgumentException("Profile settings not valid."); } }
public PduDefaultProfile(IPduProfileSettings settings) { if (settings == null || !sequenceIsValid(settings)) { throw new ArgumentNullException("Profile settings not specified or not valid."); } Settings = settings; Reset(); }
public PduHeaderSegment(IPduProfileSettings settings) { if (settings == null || settings.PduHeader == null) { throw new ArgumentNullException("Profile settings not specified."); } if (settings.PduHeader.Value < 0 || settings.PduHeader.Value > 255) { throw new ArgumentException("Value out of range."); } _header = settings.PduHeader.Value; }
private IPduProfileSettings loadDefaultProfileSettings(string name, Type profileType) { IPduProfileSettings result = null; using (var profileResource = Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(PduProfileManager), name)) { var profile = loadProfileSettings(profileResource, profileType); if (profile != null) { result = profile; } } return(result); }
public PduPidSegment(IPduProfileSettings settings) { if (settings == null) { throw new ArgumentNullException("Profile settings not specified."); } if (settings.ProtocolIdentifier != null) { if (settings.ProtocolIdentifier.Value < 0 || settings.ProtocolIdentifier.Value > 255) { throw new ArgumentException("Protocol id out of range."); } _pid = settings.ProtocolIdentifier.Value; } }
public PduMrSegment(IPduProfileSettings settings) { if (settings == null) { throw new ArgumentNullException("Profile settings not specified."); } if (settings.MessageReference != null) { if (settings.MessageReference.Value < 0 || settings.MessageReference.Value > 255) { throw new ArgumentException("Message id out of range."); } _mr = settings.MessageReference.Value; } }
public PduUdSegment(IPduProfileSettings settings, PduDcsSegment dcs) { if (settings == null) { throw new ArgumentNullException("Profile settings not specified."); } if (dcs == null || dcs.GetCodingScheme() == DCS.Other) { throw new NotSupportedException("Data coding scheme not supported."); } _dcs = dcs; _source = settings?.UserData?.Value ?? string.Empty; encode(_source, dcs.GetCoder()); }
public PduVpSegment(IPduProfileSettings settings) { if (settings == null) { throw new ArgumentNullException("Profile settings not specified."); } if (settings.ValidityPeriod != null) { if (settings.ValidityPeriod.Value < 0 || settings.ValidityPeriod.Value > 255) { throw new ArgumentException("Validity period out of range."); } _vp = settings.ValidityPeriod.Value; } }
public PduDcsSegment(IPduProfileSettings settings) { if (settings == null) { throw new ArgumentNullException("Profile settings not specified."); } if (settings.DataCodingScheme != null) { if (settings.DataCodingScheme.Value < 0 || settings.DataCodingScheme.Value > 255) { throw new ArgumentException("Data coding scheme out of range."); } _dcs = settings.DataCodingScheme.Value; } createCoders(); }
private bool sequenceIsValid(IPduProfileSettings settings) { return((settings.CanDeliver ^ settings.CanSubmit) && new HashSet <PduSegment>(settings.Sequence).Count == settings.Sequence.Count()); }