private SMS[] SMS_Process(GeneralResponse re, string command) { if (re == null) return null; if (re.IsSuccess) { SMS[] list = new SMS[re.PayLoad.Length >> 1]; for (int i = 0; i < re.PayLoad.Length; i += 2) { int index = i >> 1; list[index] = new SMS(); string[] values = re.PayLoad[i].Split(','); if (values[0].IndexOf(command) < 0) continue; list[index].MessageID = values[0].Split(' ')[1]; list[index].Status = SMS.GetSMSStatusType(values[1]); list[index].Sender = values[2].Split('"')[1]; if (values.Length >= 6) { list[index].Date = values[4].Split('"')[1]; list[index].Time = values[5].Split('"')[0]; } list[index].Message = re.PayLoad[i + 1]; } return list; } return null; }
private SMS SMS_Process(GeneralResponse re, string MessageID, string command) { if (re == null) return null; if (re.IsSuccess && re.PayLoad.Length == 2) { string[] values = re.PayLoad[0].Split(','); if (values[0].IndexOf(command) >= 0) { SMS message = new SMS(); message.Status = SMS.GetSMSStatusType(values[0].Split(' ')[1]); message.Sender = values[1].Split('"')[1]; if (values.Length >= 5) { message.Date = values[3].Split('"')[1]; message.Time = values[4].Split('"')[0]; } message.Message = re.PayLoad[1]; return message; } } return null; }
private static void M_OnNewSMSReceived(SMSStorage storage, SMS sms) { Console.WriteLine("New Message : " + storage); Console.WriteLine(sms.Sender + " : " + sms.Message); m.SMS_Delete(sms.MessageID); }