public SmppSettings() { _RemoteHost = string.Empty; _LocalHost = string.Empty; _BindParams = new SmppBindReq.BodyPdu(); _ConnectionMode = SmppConnectionMode.Transmitter; _Timeout = 0xea60; _ConnectionLifetime = 120; _SocketBufferSize = 0x800; _DisconnectOnTimeout = true; _MaxPduSize = 0x19000; _Recycling = new RecyclingSettings(); WindowSize = 7; }
public SmppSettings(string ConnectionString) { _RemoteHost = string.Empty; _LocalHost = string.Empty; _BindParams = new SmppBindReq.BodyPdu(); _ConnectionMode = SmppConnectionMode.Transmitter; _Timeout = 0xea60; _ConnectionLifetime = 120; _SocketBufferSize = 0x800; _DisconnectOnTimeout = true; _MaxPduSize = 0x19000; _Recycling = new RecyclingSettings(); WindowSize = 7; foreach (string str in ConnectionString.Split(",".ToCharArray())) { string[] strArray2 = str.Split("=".ToCharArray()); if (strArray2.Length == 2) { strArray2[0] = strArray2[0].ToLower(); switch (strArray2[0]) { case "address npi": _BindParams.AddressNpi = Convert.ToByte(strArray2[1]); break; case "address ton": _BindParams.AddressTon = Convert.ToByte(strArray2[1]); break; case "password": _BindParams.Password = strArray2[1]; break; case "system id": _BindParams.SystemId = strArray2[1]; break; case "system type": _BindParams.SystemType = strArray2[1]; break; case "remote host": _RemoteHost = strArray2[1]; break; case "remote port": _RemotePort = Convert.ToInt32(strArray2[1]); break; case "local host": _LocalHost = strArray2[1]; break; case "local port": _LocalPort = Convert.ToInt32(strArray2[1]); break; case "connection mode": _ConnectionMode = SmppConnectionMode.FromValue(Convert.ToByte(strArray2[1])); break; case "connection timeout": _Timeout = Convert.ToInt32(strArray2[1]); break; case "connection lifetime": _ConnectionLifetime = Convert.ToInt32(strArray2[1]); break; case "disconnect on timeout": _DisconnectOnTimeout = Convert.ToBoolean(strArray2[1]); break; case "max pdu size": _MaxPduSize = Convert.ToInt32(strArray2[1]); break; } } } }