public void SetErrorRates(SimErrorRates objErrorRates)
 {
     lock (this)
     {
         m_objErrorRates = new SimErrorRates(objErrorRates);
     }
 }
Beispiel #2
0
        public SimErrorRates(SimErrorRates objOther)
        {
            foreach (SimMessageErrorRate objRate in objOther.m_lsMessageErrorRates)
            {
                m_lsMessageErrorRates.Add(new SimMessageErrorRate(objRate));
            }

            foreach (SimDeliveryErrorRate objRate in objOther.m_lsDeliveryErrorRates)
            {
                m_lsDeliveryErrorRates.Add(new SimDeliveryErrorRate(objRate));
            }
        }
Beispiel #3
0
        private void SaveSettings()
        {
            var objSettings = Settings.Default;

            objSettings.LastReference     = m_objSimModel.LastReference;
            objSettings.Port              = m_objSimModel.Port;
            objSettings.IpVersion         = m_objSimModel.IpVersion;
            objSettings.AuthRequired      = m_objSimModel.IsAuthRequired;
            objSettings.SystemId          = m_objSimModel.SystemId;
            objSettings.Password          = m_objSimModel.Password;
            objSettings.PduLogEnabled     = m_objSimModel.IsPduLogEnabled;
            objSettings.ServerLogEnabled  = m_objSimModel.IsServerLogEnabled;
            objSettings.SessionLogEnabled = m_objSimModel.IsSessionLogEnabled;
            objSettings.ServerLog         = m_objSimModel.ServerLog;
            objSettings.SessionLog        = m_objSimModel.SessionLog;
            objSettings.GeneratePerMinute = m_objSimModel.GeneratePerMinute;
            objSettings.RandomOrder       = m_objSimModel.RandomOrder;
            objSettings.Echo              = m_objSimModel.Echo;
            objSettings.PduTimeout        = m_objSimModel.PduTimeout;
            objSettings.EnquireInterval   = m_objSimModel.EnquireInterval;
            objSettings.UseGsmEncoding    = m_objSimModel.UseGsmEncoding;
            objSettings.MultipartMode     = m_objSimModel.MultipartMode;
            objSettings.DeliverMode       = m_objSimModel.DeliverMode;

            objSettings.KeepMessages    = m_nKeepMaxMessages;
            objSettings.AutoMessageFile = m_strAutoMessagesFile;

            SimErrorRates objErrorRates = m_objSimModel.GetErrorRates();

            string strMessageRates = "";

            foreach (SimMessageErrorRate objErrr in objErrorRates.MessageErrorRates)
            {
                strMessageRates += string.Format("{0},{1};", objErrr.StatusCode, objErrr.Occurance);
            }
            strMessageRates = strMessageRates.TrimEnd(';');

            string strDeliveryRates = "";

            foreach (SimDeliveryErrorRate objErrr in objErrorRates.DeliveryErrorRates)
            {
                strDeliveryRates += string.Format("{0},{1},{2};", objErrr.Code, objErrr.Text, objErrr.Occurance);
            }
            strDeliveryRates = strDeliveryRates.TrimEnd(';');

            objSettings.MessageErrorRates  = strMessageRates;
            objSettings.DeliveryErrorRates = strDeliveryRates;

            objSettings.Save();
        }
        public frmErrorRates(SimErrorRates objErrorRates)
        {
            InitializeComponent();

            m_objSimErrorRates = objErrorRates;
        }
Beispiel #5
0
        private void bw_DoWork(BackgroundWorker objWorker, Logger objLogger, AxSms.SmppServer objServer)
        {
            if (m_objSimModel.IsServerLogEnabled)
            {
                objServer.LogFile = m_objSimModel.ServerLog;
            }

            AxSms.Constants objSmsConsts = new AxSms.Constants();

            objServer.LastReference = m_objSimModel.LastReference;
            objServer.Start(m_objSimModel.Port, m_objSimModel.IpVersion, m_objSimModel.Certificate);

            SimCommand objCommand = new SimCommand();

            objCommand.CommandId            = SimCommand.ECommandId.RESPONSECODE;
            objCommand.LastError            = objServer.LastError;
            objCommand.LastErrorDescription = objServer.GetErrorDescription(objServer.LastError);
            m_objSimModel.IsServerStarted   = objServer.LastError == 0;
            PushGui(objCommand);

            if (objServer.LastError != 0)
            {
                objLogger.WriteLine("SmppServer, failed: [{0}:{1}]", objCommand.LastError, objCommand.LastErrorDescription);
                return;
            }
            else
            {
                objLogger.WriteLine("SmppServer started");
            }

            // Initialize Smpp instance to do SMS splitting
            // This is very convenient because we don't need to use the orginal SmppSession object
            m_objSplitSms = new AxSms.Smpp();
            m_objSplitSms.MultipartMode  = m_objSimModel.MultipartMode;
            m_objSplitSms.UseGsmEncoding = m_objSimModel.UseGsmEncoding;

            // Replies
            long          nLastReloadReplies = GetTickCount();
            bool          bEcho         = m_objSimModel.Echo;
            SimErrorRates objErrorRates = m_objSimModel.GetErrorRates();

            // Auto messages
            long nLastReloadAutoMsg = GetTickCount();
            var  lsAutoMessages     = new List <SimMessage>();

            lsAutoMessages = m_objSimModel.GetAutoMessages();
            int    nGeneratePerMinute = m_objSimModel.GeneratePerMinute;
            bool   bRandomOrder       = m_objSimModel.RandomOrder;
            int    nAutoMsgIndex      = 0;
            Random objRandom          = new Random();

            var dctWrkSessions = new Dictionary <int, WrkSession>();

            while (!objWorker.CancellationPending)
            {
                var lsMessagesUpdated   = new List <SimMessage>();
                var lsMessagesGenerated = new List <SimMessage>();
                var lsMessagesReceived  = new List <SimMessage>();

                // Check if the GUI has some requests
                while ((objCommand = PollGui()) != null)
                {
                    WrkSession objWrkSession = null;
                    dctWrkSessions.TryGetValue(objCommand.SessionId, out objWrkSession);
                    switch (objCommand.CommandId)
                    {
                    case SimCommand.ECommandId.DROPSESSION:
                        if (objWrkSession != null)
                        {
                            objWrkSession.bDrop = true;
                        }
                        break;

                    case SimCommand.ECommandId.SENDMESSAGE:
                        if (objWrkSession != null)
                        {
                            bw_AddOutgoing(objCommand.Message, objWrkSession.qOutMessages, lsMessagesGenerated, true);
                        }
                        break;
                    }
                }

                // Quit if the server stopped for some reason
                if (!objServer.IsStarted)
                {
                    m_objSimModel.IsServerStarted = false;
                    break;
                }

                // Reset statistics count
                int nRecvPerSecond = 0, nSentPerSecond = 0;
                // Handle connected sessions
                var lsSessions               = new List <SimSession>();
                AxSms.SmppSession objSession = objServer.GetFirstSession();
                while (objServer.LastError == 0)
                {   // Creating objSimSession object early and only access it's properties since
                    // accessing ActiveX properties (and methods) seems to be expensive in C#
                    SimSession objSimSession = new SimSession(objSession);
                    lsSessions.Add(objSimSession);

                    // Get the current worker session
                    WrkSession objWrkSession = null;
                    if (!dctWrkSessions.ContainsKey(objSession.Id))
                    {
                        dctWrkSessions[objSession.Id] = objWrkSession = new WrkSession(objSimSession, GetTickCount());
                    }
                    else
                    {
                        objWrkSession = dctWrkSessions[objSession.Id];
                    }

                    // Handle session bind requests
                    if (objSimSession.ConnectionState == objSmsConsts.SMPP_SESSIONSTATE_BINDING)
                    {
                        // Respond to a bind required. If authentication is required test sysid
                        int iResponse = 0;
                        if (m_objSimModel.IsAuthRequired &&
                            (objSimSession.SystemId != m_objSimModel.SystemId ||
                             objSimSession.Password != m_objSimModel.Password))
                        {
                            iResponse = objSmsConsts.SMPP_ESME_RINVPASWD;
                        }
                        objSession.RespondToBind(iResponse);

                        // Generate a logfile path and set it
                        if (m_objSimModel.IsSessionLogEnabled)
                        {
                            string strLogIp;
                            if (objSimSession.Ip.Contains("."))
                            {   // IPv4; np
                                strLogIp = objSimSession.Ip;
                            }
                            else
                            {   // IPv6, can't have ':''s in a filename !
                                strLogIp = string.Format("[{0}]", objSimSession.Ip).Replace(':', '_');
                            }

                            string strLogPath = string.Format("{0}{1}_{2}.log",
                                                              m_objSimModel.SessionLog, strLogIp, objSimSession.Port);
                            objSession.LogPduDetails = m_objSimModel.IsPduLogEnabled;
                            objSession.LogFile       = strLogPath;
                        }

                        // Apply server settings
                        objSession.PduTimeout      = m_objSimModel.PduTimeout;
                        objSession.EnquireInterval = m_objSimModel.EnquireInterval;
                        objSession.UseGsmEncoding  = m_objSimModel.UseGsmEncoding;
                        objSession.DeliverMode     = m_objSimModel.DeliverMode;
                    }

                    // Generate auto-messages.
                    int iNumMessages = objWrkSession.CalculateMessagesToSend(GetTickCount(), nGeneratePerMinute);
                    if (lsAutoMessages.Count > 0)
                    {
                        for (int i = 0; i < iNumMessages; i++)
                        {   // Determine the message index of the auto-message to sent
                            if (bRandomOrder)
                            {
                                nAutoMsgIndex = objRandom.Next(lsAutoMessages.Count);
                            }
                            else
                            {
                                if (nAutoMsgIndex < lsAutoMessages.Count - 1)
                                {
                                    nAutoMsgIndex++;
                                }
                                else
                                {
                                    nAutoMsgIndex = 0;
                                }
                            }

                            // If there's room in the output queue, add it to the output queue
                            // othewise, reject the message, queue full..
                            SimMessage objMessage = new SimMessage(lsAutoMessages[nAutoMsgIndex]);
                            objMessage.SessionId = objSimSession.Id;
                            objMessage.SystemId  = objSimSession.SystemId;
                            bw_AddOutgoing(objMessage, objWrkSession.qOutMessages, lsMessagesGenerated, true);
                        }
                    }

                    // Sent SMS messages in sent queue
                    int nOut = objSession.CountSmsDeliverySpace();
                    while (objWrkSession.qOutMessages.Count > 0 && nOut > 0)
                    {
                        SimMessage    objSimMessage = objWrkSession.qOutMessages.Dequeue();
                        AxSms.Message objMessage    = objSimMessage.CreateAxSms();

                        // reject multipart messages because they should all have been splitup before beeing
                        // added to the output queue.
                        objSession.DeliverSms(objMessage, objSmsConsts.MULTIPART_REJECT);
                        if (objSession.LastError != 0)
                        {
                            objSimMessage.Status = string.Format("SUBMITERROR({0})", objSession.LastError);
                        }
                        else
                        {
                            objSimMessage.Status = "DELIVERED";
                        }

                        lsMessagesUpdated.Add(objSimMessage);
                    }

                    // Fetch updates for messages that have been sent
                    AxSms.Message objResponse = objSession.ReceiveDeliverResponse();
                    while (objSession.LastError == 0)
                    {
                        SimMessage objSimMessage = new SimMessage(objResponse);
                        objSimMessage.SystemId  = objSimSession.SystemId;
                        objSimMessage.SessionId = objSimSession.Id;
                        objSimMessage.Status    = objSmsConsts.SmppEsmeToString(objSimMessage.CommandStatus).Replace("SMPP_ESME_", "");
                        lsMessagesUpdated.Add(objSimMessage);
                        objResponse = objSession.ReceiveDeliverResponse();
                    }

                    // Fetch received messages
                    AxSms.Message objReceived = objSession.ReceiveSubmitSms();
                    while (objSession.LastError == 0)
                    {
                        SimMessage objSimMessage = new SimMessage(objReceived);
                        objSimMessage.SystemId  = objSimSession.SystemId;
                        objSimMessage.SessionId = objSimSession.Id;

                        // Determine command status
                        int nCommandStatus     = 0;
                        int nRandCmdStatus     = objRandom.Next(100);
                        int nRandCmdStatusOffs = 0;
                        foreach (SimMessageErrorRate objErrr in objErrorRates.MessageErrorRates)
                        {
                            nRandCmdStatusOffs += objErrr.Occurance;
                            if (nRandCmdStatus <= nRandCmdStatusOffs)
                            {
                                nCommandStatus = objErrr.StatusCode;
                                break;
                            }
                        }

                        // Respond to SMS message
                        objReceived.SmppCommandStatus = objSimMessage.CommandStatus = nCommandStatus;
                        objSession.RespondToSubmitSms(objReceived);

                        // Set message status text and add it to the 'received' list
                        // generate a usertag for received messages as well. The GUI relies on every message to have a unique ID
                        objSimMessage.Status  = objSmsConsts.SmppEsmeToString(objSimMessage.CommandStatus).Replace("SMPP_ESME_", "");
                        objSimMessage.UserTag = m_objSimModel.GetAndIncLastUserTag();
                        lsMessagesReceived.Add(objSimMessage);

                        // Determine command status
                        if (objSimMessage.RequestDeliveryReport && nCommandStatus == 0)
                        {
                            int    nRandDlrStatus     = objRandom.Next(100);
                            int    nRandDlrStatusOffs = 0;
                            int    nStatusCode        = objSmsConsts.SMPP_MESSAGESTATE_DELIVERED;
                            string strStatusText      = "DELIVRD";
                            foreach (SimDeliveryErrorRate objErrr in objErrorRates.DeliveryErrorRates)
                            {
                                nRandDlrStatusOffs += objErrr.Occurance;
                                if (nRandDlrStatus <= nRandDlrStatusOffs)
                                {
                                    nStatusCode   = objErrr.Code;
                                    strStatusText = objErrr.Text;
                                    break;
                                }
                            }
                            SimMessage objDlr = bw_CreateDlr(objSimMessage, objSimSession.Version, nStatusCode, strStatusText, objSmsConsts);
                            bw_AddOutgoing(objDlr, objWrkSession.qOutMessages, lsMessagesGenerated, false);
                        }

                        if (bEcho)
                        {
                            SimMessage objEcho = new SimMessage(objSimMessage);
                            objEcho.FromAddress    = objSimMessage.ToAddress;
                            objEcho.FromAddressNpi = objSimMessage.ToAddressNpi;
                            objEcho.FromAddressTon = objSimMessage.ToAddressTon;
                            objEcho.ToAddress      = objSimMessage.FromAddress;
                            objEcho.ToAddressNpi   = objSimMessage.FromAddressNpi;
                            objEcho.ToAddressTon   = objSimMessage.FromAddressTon;
                            bw_AddOutgoing(objEcho, objWrkSession.qOutMessages, lsMessagesGenerated, false);
                        }

                        objReceived = objSession.ReceiveSubmitSms();
                    }

                    // Don't support SMS queries
                    objReceived = objSession.ReceiveQuerySms();
                    while (objSession.LastError == 0)
                    {   // Just immediately respond with an error.
                        objReceived.SmppCommandStatus = objSmsConsts.SMPP_ESME_RINVCMDID;
                        objSession.RespondToQuerySms(objReceived);
                        objReceived = objSession.ReceiveQuerySms();
                    }

                    if (objWrkSession.bDrop)
                    {
                        objSession.Disconnect();
                    }

                    // Update statistics
                    nRecvPerSecond += objSession.SmsReceivedPerSecond;
                    nSentPerSecond += objSession.SmsSentPerSecond;

                    objSession = objServer.GetNextSession();
                }

                // Make a list of disconnected sessions
                var lsDisconnected = new List <SimSession>();
                objSession = objServer.GetClosedSession();
                while (objServer.LastError == 0)
                {
                    SimSession objSimSession = new SimSession(objSession);
                    lsDisconnected.Add(objSimSession);
                    dctWrkSessions.Remove(objSimSession.Id);
                    objSession = objServer.GetClosedSession();
                }

                // Set global stats
                m_objSimModel.RecvPerSecond = nRecvPerSecond;
                m_objSimModel.SentPerSecond = nSentPerSecond;
                m_objSimModel.LastReference = objServer.LastReference;

                // See if there's a need to sent the delta messages to the GUI
                if (lsMessagesUpdated.Count > 0 ||
                    lsMessagesReceived.Count > 0 ||
                    lsMessagesGenerated.Count > 0)
                {
                    objCommand                   = new SimCommand();
                    objCommand.CommandId         = SimCommand.ECommandId.MESSAGESDELTA;
                    objCommand.MessagesUpdated   = lsMessagesUpdated;
                    objCommand.MessagesReceived  = lsMessagesReceived;
                    objCommand.MessagesGenerated = lsMessagesGenerated;
                    PushGui(objCommand);
                }

                if (lsDisconnected.Count > 0)
                {
                    objCommand           = new SimCommand();
                    objCommand.CommandId = SimCommand.ECommandId.DROPSESSION;
                    objCommand.Sessions  = lsDisconnected;
                    PushGui(objCommand);
                }

                // Don't continuously refresh the auto-messages. They are not updated that often and
                // a small lag here is not very noticable.
                if (GetTickCount() - nLastReloadAutoMsg > AUTOMESSAGE_RELOAD_TOMS)
                {
                    nLastReloadAutoMsg = GetTickCount();
                    lsAutoMessages     = m_objSimModel.GetAutoMessages();
                    nGeneratePerMinute = m_objSimModel.GeneratePerMinute;
                    bRandomOrder       = m_objSimModel.RandomOrder;
                }

                // Don't continuously refresh reply settings, but do refresh them a bit
                // more often than the autoreply settings because its very visible.
                if (GetTickCount() - nLastReloadReplies > REPLIES_RELOAD_TOMS)
                {
                    nLastReloadReplies = GetTickCount();
                    bEcho         = m_objSimModel.Echo;
                    objErrorRates = m_objSimModel.GetErrorRates();
                }

                m_objSimModel.SetSessions(lsSessions);

                Thread.Sleep(100);
            }
        }
Beispiel #6
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            var objSettings = Settings.Default;

            // force save settings right away
            objSettings.LastReference = objSettings.LastReference;
            objSettings.Save();

            m_Logger = new Logger(objSettings.ViewLogFile);
            m_Logger.WriteLine("Startup SMPP Simulator");

            m_objSimWorker    = new SimWorker();
            m_objSimModel     = m_objSimWorker.SimModel;
            m_objSmsConstants = new AxSms.Constants();

            // IP Version combo box
            var dctIpVersion = new Dictionary <string, int>();

            dctIpVersion.Add("IPv6/IPv4", m_objSmsConstants.SMPP_IPVERSION_BOTH);
            dctIpVersion.Add("IPv6", m_objSmsConstants.SMPP_IPVERSION_6);
            dctIpVersion.Add("IPv4", m_objSmsConstants.SMPP_IPVERSION_4);

            cbxIpVersion.DisplayMember = "Key";
            cbxIpVersion.ValueMember   = "Value";
            cbxIpVersion.DataSource    = new BindingSource(dctIpVersion, null);

            // Make sure to update all the SESSION_ constants when changing stuff here !!!!
            lvSessions.Columns.Add("Client IP", (int)(lvSessions.Width * .25), HorizontalAlignment.Left);
            lvSessions.Columns.Add("Client Port", (int)(lvSessions.Width * .25), HorizontalAlignment.Left);
            lvSessions.Columns.Add("SystemID", (int)(lvSessions.Width * .24), HorizontalAlignment.Left);
            lvSessions.Columns.Add("Connection State", (int)(lvSessions.Width * .25), HorizontalAlignment.Left);
            lvSessions.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.HeaderSize);

            // Make sure to update all the MESSAGE_ constants when changing stuff here !!!!
            lvMessages.Columns.Add("Dir.", (int)(lvMessages.Width * .1), HorizontalAlignment.Left);
            lvMessages.Columns.Add("SystemID", (int)(lvMessages.Width * .20), HorizontalAlignment.Left);
            lvMessages.Columns.Add("ToAddress", (int)(lvMessages.Width * .15), HorizontalAlignment.Left);
            lvMessages.Columns.Add("Reference", (int)(lvMessages.Width * .15), HorizontalAlignment.Left);
            lvMessages.Columns.Add("State", (int)(lvMessages.Width * .15), HorizontalAlignment.Left);
            lvMessages.Columns.Add("Body", -2, HorizontalAlignment.Left);

            // Make sure to update all the AUTOMESSAGE_ constants when changing stuff here !!!!
            lvAutoMessage.Columns.Add("FromAddress", (int)(lvAutoMessage.Width * .20), HorizontalAlignment.Left);
            lvAutoMessage.Columns.Add("ToAddress", (int)(lvAutoMessage.Width * .20), HorizontalAlignment.Left);
            lvAutoMessage.Columns.Add("Body", (int)(lvAutoMessage.Width * .59), HorizontalAlignment.Left);

            // Set the hyperlinks in the GUI
            llblAxLink.Text = "Try other SMS software products by Auron Software.";
            llblAxLink.Links.Add(llblAxLink.Text.IndexOf("SMS software products"), "SMS software products".Length, "https://www.auronsoftware.com/products/");
            llblAxLink.LinkClicked += new LinkLabelLinkClickedEventHandler(llblAxLink_LinkClicked);

            llblFooterText.Text  = "Auron SMPP Simulator is freeware. It uses Auron SMS Component.\r\n";
            llblFooterText.Text += "For more information on Auron SMS products, click here.";
            llblFooterText.Links.Add(llblFooterText.Text.IndexOf("click here"), "click here".Length, "https://www.auronsoftware.com/products/");
            llblFooterText.LinkClicked += new LinkLabelLinkClickedEventHandler(llblAxLink_LinkClicked);

            // Initialize model
            m_objSimModel.LastReference       = objSettings.LastReference + SimConstants.ADDREFERENCES_ONAPPSTART;
            m_objSimModel.Port                = objSettings.Port;
            m_objSimModel.IpVersion           = objSettings.IpVersion;
            m_objSimModel.IsAuthRequired      = objSettings.AuthRequired;
            m_objSimModel.SystemId            = objSettings.SystemId;
            m_objSimModel.Password            = objSettings.Password;
            m_objSimModel.IsPduLogEnabled     = objSettings.PduLogEnabled;
            m_objSimModel.IsServerLogEnabled  = objSettings.ServerLogEnabled;
            m_objSimModel.IsSessionLogEnabled = objSettings.SessionLogEnabled;
            m_objSimModel.ServerLog           = objSettings.ServerLog;
            m_objSimModel.SessionLog          = objSettings.SessionLog;
            m_objSimModel.GeneratePerMinute   = objSettings.GeneratePerMinute;
            m_objSimModel.RandomOrder         = objSettings.RandomOrder;
            m_objSimModel.Echo                = objSettings.Echo;
            m_objSimModel.PduTimeout          = objSettings.PduTimeout;
            m_objSimModel.EnquireInterval     = objSettings.EnquireInterval;
            m_objSimModel.UseGsmEncoding      = objSettings.UseGsmEncoding;
            m_objSimModel.MultipartMode       = objSettings.MultipartMode;
            m_objSimModel.DeliverMode         = objSettings.DeliverMode;
            m_objSimModel.CertificateStore    = objSettings.CertificateStore;

            m_nKeepMaxMessages    = objSettings.KeepMessages;
            m_strAutoMessagesFile = objSettings.AutoMessageFile;

            // pre-load auto messages
            if (LoadAutoMessages(m_strAutoMessagesFile) != 0)
            {
                SimMessage objMessage = null;
                AddToAutoMessage(new SimMessage("+123123123", SimConstants.DEFAULT_FROMADDRESS, "Hello, World!"));
                AddToAutoMessage(objMessage = new SimMessage("+321321321", SimConstants.DEFAULT_FROMADDRESS, "مرحبا، العالم"));
                objMessage.DataCoding       = m_objSmsConstants.DATACODING_UNICODE;
                AddToAutoMessage(objMessage = new SimMessage("+231231231", SimConstants.DEFAULT_FROMADDRESS, "नमस्ते दुनिया"));
                objMessage.DataCoding       = m_objSmsConstants.DATACODING_DEFAULT;
                objMessage.LanguageShift    = m_objSmsConstants.LANGUAGE_SINGLESHIFT_HINDI;
                AddToAutoMessage(objMessage = new SimMessage("+123123123", SimConstants.DEFAULT_FROMADDRESS, "48656c6c6f2c20576f726c6421"));
                objMessage.BodyFormat       = m_objSmsConstants.BODYFORMAT_HEX;
            }
            PushAutoMessages();

            // Push error rates to model.
            SimErrorRates objErrorRates    = new SimErrorRates();
            string        strMessageRates  = objSettings.MessageErrorRates;
            string        strDeliveryRates = objSettings.DeliveryErrorRates;

            string[] aMessageRates = strMessageRates.Split(';');
            try
            {
                foreach (string strMessageRate in aMessageRates)
                {
                    SimMessageErrorRate objErrr      = new SimMessageErrorRate();
                    string[]            aMessageRate = strMessageRate.Split(',');
                    objErrr.StatusCode = int.Parse(aMessageRate[0]);
                    objErrr.Occurance  = int.Parse(aMessageRate[1]);
                    objErrorRates.MessageErrorRates.Add(objErrr);
                }
            }
            catch (Exception x)
            {
                m_Logger.WriteLine("Error while parsing message rates: {0}", x.ToString());
            }

            string[] aDeliveryRates = strDeliveryRates.Split(';');
            try
            {
                foreach (string strDeliveryRate in aDeliveryRates)
                {
                    SimDeliveryErrorRate objErrr       = new SimDeliveryErrorRate();
                    string[]             aDeliveryRate = strDeliveryRate.Split(',');
                    objErrr.Code      = int.Parse(aDeliveryRate[0]);
                    objErrr.Text      = aDeliveryRate[1];
                    objErrr.Occurance = int.Parse(aDeliveryRate[2]);
                    objErrorRates.DeliveryErrorRates.Add(objErrr);
                }
            }
            catch (Exception x)
            {
                m_Logger.WriteLine("Error while parsing delivery rates: {0}", x.ToString());
            }

            m_objSimModel.SetErrorRates(objErrorRates);

            // Set other control values
            txtServerLog.Text          = m_objSimModel.ServerLog;
            txtSessionLog.Text         = m_objSimModel.SessionLog;
            cbEnableServerLog.Checked  = m_objSimModel.IsServerLogEnabled;
            cbEnableSessionLog.Checked = m_objSimModel.IsSessionLogEnabled;
            cbEnablePduLog.Checked     = m_objSimModel.IsPduLogEnabled;
            cbAuthentication.Checked   = m_objSimModel.IsAuthRequired;
            txtSystemId.Text           = m_objSimModel.SystemId;
            txtPassword.Text           = m_objSimModel.Password;
            txtMaxSendPerMinute.Text   = m_objSimModel.GeneratePerMinute.ToString();
            cbRandom.Checked           = m_objSimModel.RandomOrder;
            cbEcho.Checked             = m_objSimModel.Echo;

            ReloadCertificates();

            objSettings.Save();
            UpdateControls();
        }