Пример #1
0
        private void ParseMessages(string input)
        {
            if (input == null)
            {
                return;
            }
            try
            {
                Regex r = new Regex(@"\+CMGL: (\d+),""(.+)"",""(.+)"",(.*),""(.+)""\r\n(.+)\r\n");
                Match m = r.Match(input);
                while (m.Success)
                {
                    ShortMessageArgs msg = new ShortMessageArgs
                    {
                        Index    = m.Groups[1].Value,
                        Status   = m.Groups[2].Value,
                        Sender   = m.Groups[3].Value,
                        Alphabet = m.Groups[4].Value,
                        Sent     = m.Groups[5].Value,
                        Message  = m.Groups[6].Value
                    };

                    OnRaiseSmsRecievedEvent(msg);
                    m = m.NextMatch();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
 /// <summary>
 /// Trigger für das Event SMS empfangen
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnRaiseSmsRecievedEvent(ShortMessageArgs e)
 {
     RaiseSmsRecievedEvent?.Invoke(this, e);
 }