Esempio n. 1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>Funtion to build a full MultipartMessageType, from simple fields.</summary>
        /// <param name="destinations">An array of phoneNumber destinations.</param>
        /// <param name="subject">The subject of the MMS.</param>
        /// <param name="originAddress">The sender address.</param>
        /// <param name="senderName">Optional: A sender name.</param>
        /// <param name="message">Optional: A text message that will be sent as a text attachment.</param>
        /// <param name="attachments">Optional: List of attachments to be sent.</param>
        /// <param name="endpoint">Optional: String which contains the endpoint where status notifications will be sent.</param>
        /// <param name="correlator">Optional, Mandatory if Notifications: The correlator for the status notifications.</param>
        /// <returns>A MultipartMessageType, ready to be serialized and sent.</returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        public static Schemas.MultipartMessageType CreateMultipartMessageType(string[] destinations, string subject
            , MMS.Schemas.UserIdType originAddress
            , string senderName = null, string message = null, Schemas.Attachment[] attachments = null
            , string endpoint = null, string correlator = null)
        {

            Schemas.MultipartMessageType multipartMessage = new Schemas.MultipartMessageType();
            Schemas.MessageType messageType = new Schemas.MessageType();

            messageType.address = new Schemas.UserIdType[destinations.Length];
            for (int i = 0; i < destinations.Length; i++)
            {
                Core.Tools.Extension.checkIsNumber(destinations[i], "destination");
                messageType.address[i] = new Schemas.UserIdType() { Item = destinations[i]
                    , ItemElementName = Schemas.ItemChoiceType1.phoneNumber 
                };
            }

            messageType.originAddress =  originAddress;

            messageType.subject = subject;

            messageType.senderName = senderName;

            if (!string.IsNullOrEmpty(endpoint) && !string.IsNullOrEmpty(correlator))//Both endpoint and correlator arent null nor empty
            {
                messageType.receiptRequest = new Schemas.SimpleReferenceType() { endpoint = endpoint, correlator = correlator };
            }

            multipartMessage.message = message;

            //Translating attachments to attachmentInfos
            Schemas.AttachmentInfo[] attachmentInfos = null;
            if (attachments == null)
            {
                attachmentInfos = new Schemas.AttachmentInfo[0];
            }
            else
            {
                attachmentInfos = new Schemas.AttachmentInfo[attachments.Length];
                for (var i = 0; i < attachments.Length; i++)
                {
                    if (attachments[i] != null)
                    {
                        attachmentInfos[i] = new Schemas.AttachmentInfo(
                            attachments[i].fileName, Tools.MMSTools.extractMIMEText(attachments[i].mimeType)
                            );
                    }
                }
            }
            multipartMessage.attachments = attachmentInfos;

            multipartMessage.messageType = messageType;

            return multipartMessage;
        }
Esempio n. 2
0
        //public string SendMessages()

        //{
        //    ISender MMS = new MMS();
        //    ISender SMS = new SMS();
        //    ISender E_Mail = new E_Mail();
        //    return ;

        //}
        static void Main(string[] args)
        {
            //IPay payment = null;
            //string input = Console.ReadLine();
            //switch (input)
            //{
            //    case "cash":
            //        payment = new Cash();
            //        break;
            //    case "card":
            //        payment = new Card();
            //        break;
            //    case "tr":
            //        payment = new Transfer();
            //        break;
            //    case "blik":
            //        payment = new Blik();
            //        break;
            //    default:
            //        break;
            //}
            //try
            //{
            //    Console.WriteLine(payment.Payment(13));
            //}
            //catch (Exception ex)
            //{

            //    Console.WriteLine(ex.Message);
            //}
            //Door door = new Door();
            //var smart = door as IStandard;
            //Console.WriteLine(smart.Close());
            //Console.WriteLine(((IStandard)door).Open());
            ISender MMS    = new MMS();
            ISender SMS    = new SMS();
            ISender E_Mail = new E_Mail();
            ISender Pigeon = new Pigeon();

            Console.WriteLine($"Wysyłam widomość za pomocą: {MMS.Method()} {SMS.Method()} {E_Mail.Method()} {Pigeon.Method()}");


            Console.Read();
        }
Esempio n. 3
0
        private async Task <QRCodeData> GenerateTextMessageQrCode(CreateTextMessageModel model)
        {
            Payload payload;

            switch (model.TextMessageType)
            {
            case TextMessageType.SMS:
                payload = new SMS(model.Phone, model.Body, model.SmsEncoding);
                break;

            case TextMessageType.MMS:
                payload = new MMS(model.Phone, model.Body, model.MmsEncoding);
                break;

            default: throw new NotImplementedException();
            }

            return(await GenerateAsync(payload));
        }
Esempio n. 4
0
        private void btnSendUSSD_Click(object sender, EventArgs e)
        {
            string port        = cboPort.Text;
            string ussdCommand = txtCommandBox.Text;

            if (port != "")
            {
                Task task = Task.Factory.StartNew(() =>
                {
                    MMS mainForm = new MMS();
                    mainForm.bgTimer.Stop();
                    mainForm.bgWorker.CancelAsync();
                    SendUSSD(port, ussdCommand);
                });
                pnlUSD.Visible = false;
                MessageBox.Show("Command has been successfully sent to :" + port);
            }
            else
            {
                MessageBox.Show("Please select a port.");
            }
        }
        private void button6_Click(object sender, RoutedEventArgs e)
        {
            if (textBox7.Text != "")
            {
                try
                {
                    //Console.WriteLine("Запуск");
                    logger.Trace("Запуск");

                    TestSendStruct testSend;
                    testSend.name = textBox7.Text;
                    testSend.fre  = textBox7.Text;
                    testSend.ab   = textBox7.Text;
                    testSend.cd   = textBox7.Text;

                    MMS ms1 = new MMS(testSend);

                    metaClassFor = new MetaClassForStructandtherdata(ms1);
                    // создаем объект BinaryFormatter
                    BinaryFormatter formatter = new BinaryFormatter();
                    formatter.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Full;
                    var stream = new MemoryStream();

                    formatter.Serialize(stream, metaClassFor);

                    //Console.WriteLine("Отправка данных");
                    logger.Trace("Отправка данных");

                    masterSyncStruct.send_multi_message(stream);

                    Console.WriteLine(stream);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    logger.Error(ex);
                }
            }
        }
        private void button8_Click(object sender, RoutedEventArgs e)
        {
            if (textBox7.Text != "")
            {
                Test2SendStruct test2SendStruct;
                test2SendStruct.name   = textBox7.Text;
                test2SendStruct.fre    = textBox7.Text;
                test2SendStruct.ab     = textBox7.Text;
                test2SendStruct.cd     = textBox7.Text;
                test2SendStruct.count  = 1;
                test2SendStruct.count2 = 2;

                ms = new MMS(test2SendStruct);

                try
                {
                    metaClassFor = new MetaClassForStructandtherdata(ms);

                    // создаем объект BinaryFormatter
                    BinaryFormatter formatter = new BinaryFormatter();
                    formatter.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Full;
                    var stream = new MemoryStream();

                    formatter.Serialize(stream, metaClassFor);

                    masterSyncStruct.send_multi_message(stream);

                    Console.WriteLine(stream);
                }
                catch (Exception ex)
                {
                    //Console.WriteLine(ex);
                    logger.Error(ex);
                }
            }
        }
Esempio n. 7
0
        private void btnPSend_Click(object sender, EventArgs e)
        {
            List <string> portsSelected = new List <string>();

            for (int i = 0; i < lstGrid.Rows.Count; i++)
            {
                bool isChecked = (bool)lstGrid.Rows[i].Cells[0].Value;

                if (isChecked)
                {
                    portsSelected.Add(lstGrid.Rows[i].Cells[1].Value.ToString());
                }
            }
            //string selectedPort = lstGrid.Rows[i].Cells[1].Value.ToString();
            if (portsSelected.Count > 0)
            {
                str = Model.promotionModel.getGroupMembersNumber(cboSendTo.Text);
                if (str == "success")
                {
                    List <string> mobileNumbers = new List <string>();
                    int           errorCounter  = 0;
                    for (int count = 0; count < config.records.Count; count++)
                    {
                        string           mobileNumber = config.records[count].mobile_no.ToString();
                        Entity.variables entity       = new Entity.variables();
                        entity.promotionTitle = txtTitle.Text;
                        entity.mobile_no      = mobileNumber;

                        string insertLastPromoSent = Model.promotionModel.addLastSentPromotion(entity);
                        if (insertLastPromoSent == "success")
                        {
                            mobileNumbers.Add(mobileNumber);
                        }
                    }

                    if (errorCounter == 0)
                    {
                        string message  = txtDetails.Text;
                        MMS    mainForm = new MMS();
                        mainForm.bgTimer.Stop();
                        mainForm.bgWorker.CancelAsync();
                        Task task = Task.Factory.StartNew(() =>
                        {
                            sendPromo(portsSelected, mobileNumbers, message);
                        });

                        MessageBox.Show("The Promo has been sent to " + cboSendTo.Text);
                    }
                    else
                    {
                        MessageBox.Show("Unable to sent the promo to " + cboSendTo.Text);
                    }

                    pnlPortsToSend.Visible = false;
                }
            }
            else
            {
                MessageBox.Show("Please select a port.");
            }
        }
Esempio n. 8
0
        public async void sendPromo(List <string> ports, List <string> mobileNumbers, string promoDetails)
        {
            logs.log("Sending Promo...");
            List <Task> tasks = new List <Task>();

            foreach (string port in ports)
            {
                var task = Task.Factory.StartNew(() =>
                {
                    try
                    {
                        //Serial Ports Setting
                        SerialPort sp = new SerialPort();
                        sp.PortName   = port;
                        sp.BaudRate   = 115200;
                        sp.Parity     = Parity.None;
                        sp.StopBits   = StopBits.One;
                        sp.DataBits   = 8;
                        sp.Handshake  = Handshake.None;
                        sp.RtsEnable  = true;
                        sp.NewLine    = "\n";


                        sp.Open();



                        if (sp.IsOpen)
                        {
                            sp.WriteLine("AT+CMGF=1\r");
                            Thread.Sleep(500);
                            //logs.log(sp.ReadExisting());
                            sp.WriteLine("AT+CMGD=1\r");
                            Thread.Sleep(500);
                            //logs.log(sp.ReadExisting());
                            sp.WriteLine("AT+CMGW=\"" + mobileNumbers[0] + "\"\r");
                            Thread.Sleep(500);
                            //logs.log(sp.ReadExisting());
                            sp.WriteLine(promoDetails + "\x1a");
                            Thread.Sleep(500);
                            //logs.log(sp.ReadExisting());
                            foreach (string mobileNumber in mobileNumbers)
                            {
                                sp.WriteLine("AT+CMSS=1,\"" + mobileNumber + "\"\r");
                                Thread.Sleep(4000);
                                logs.log("Sending promo message to :" + mobileNumber + " OK");

                                //logs.log(sp.ReadExisting());
                            }
                            sp.WriteLine("AT+CMGD=1\r");
                            Thread.Sleep(500);
                            //logs.log(sp.ReadExisting());
                        }


                        sp.Close();
                    }
                    catch (Exception exception)
                    {
                        //Log the Error
                        logs.log("Exception: " + exception.Message);
                    }
                });
                tasks.Add(task);
                //taskIndex++;
            }
            await Task.WhenAll(tasks.ToArray());

            MMS mainForm = new MMS();

            mainForm.bgTimer.Start();

            //MMS mf = new MMS();
            //mf.checkForIncommingMessage();


            logs.log("Sending Promo OK");
        }
Esempio n. 9
0
        public void SendUSSD(string port, string ussdCode)
        {
            logs.log("Sending USSD Command...");

            //Serial Ports Setting
            SerialPort sp = new SerialPort();

            sp.PortName  = port;
            sp.BaudRate  = 115200;
            sp.Parity    = Parity.None;
            sp.StopBits  = StopBits.One;
            sp.DataBits  = 8;
            sp.Handshake = Handshake.None;
            sp.RtsEnable = true;
            sp.NewLine   = "\n";


            try
            {
                sp.Open();



                if (sp.IsOpen)
                {
                    sp.WriteLine("AT+CMGF=0\r");
                    Thread.Sleep(500);
                    sp.ReadExisting();
                    logs.log("Sending USSD Code(" + ussdCode + ") to : " + port + " OK");
                    sp.WriteLine("AT+CUSD=1,\"" + ussdCode + "\"\r");
                    sp.ReadExisting();
                    Thread.Sleep(6000);
                    string commandReponse = sp.ReadExisting();
                    if (commandReponse.Contains("OK"))
                    {
                        int    startingIndex = commandReponse.IndexOf("+CUSD: 2,\"");
                        int    endingIndex   = commandReponse.IndexOf("\",15");
                        int    trimLength    = endingIndex - startingIndex;
                        string trimFinalOut  = commandReponse.Substring(startingIndex, trimLength);
                        logs.log("USSD Command Reply :\r" + trimFinalOut + " \rOK");
                        Regex            regEx = new Regex(@"\+CUSD: 2,\""(.+)");
                        Match            match = regEx.Match(trimFinalOut);
                        Entity.variables ent   = new Entity.variables();
                        ent.reply       = match.Groups[1].Value;
                        ent.dateCreated = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt");
                        Model.ussdHistoryModel.addHistory(ent);
                        Task.Factory.StartNew(() =>
                        {
                            MessageBox.Show("USSD Command Reply :\r" + trimFinalOut + " \rOK");
                            loadDataFromUssdHistory();
                        });
                    }
                    else
                    {
                        logs.log("USSD Command Reply :\r There is unexpected error. Please try agian. \rERROR");
                        MessageBox.Show("USSD Command Reply :\r There is unexpected error. Please try agian. \rERROR");
                    }
                }
            }
            catch (Exception exception)
            {
                //Log the Error
                logs.log("ExceptionUSSD: " + exception.Message);
            }
            finally
            {
                sp.Close();
            }



            MMS mainForm = new MMS();

            mainForm.bgTimer.Start();
            logs.log("Sending USSD Command OK");
        }
Esempio n. 10
0
 public void MMSTestBlankMessage()
 {
     MMS MMSMessage = new MMS("085123456", "John", true, "", "VideoMsg", MessageType.Video);
 }
Esempio n. 11
0
        public void MMSTest()

        {
            MMS MMSMessage = new MMS("085123456", "John", true, "Hello here's a video", "VideoMsg", MessageType.Video);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>MMS sending process.</summary>
        /// <param name="destination">An array of address of the recipient of the message.</param>
        /// <param name="subject">The subject of the mms to send.</param>
        /// <param name="originAddress">The sender's phone Number</param>
        /// <param name="xChargedId">The phone number of the api payer. If not indicated, the payer will be the sender.</param>
        /// <param name="senderName">Human-readable text for remitent.</param>
        /// <param name="message">A text message that will be sent as a text attachment.</param>
        /// <param name="attachments">List of attachments to be sent.</param>
        /// <param name="endpoint">String which contains the endpoint where status notifications will be sent.</param>
        /// <param name="correlator">The correlator for the status notifications.</param>
        /// <returns>It returns a String containing the mmsId of the MMS sent. To poll for delivery status.</returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        protected string SendProcess(string[] destination, string subject, MMS.Schemas.UserIdType originAddress
            , string xChargedId, string senderName 
            , string message, Attachment[] attachments
            , string endpoint, string correlator)
        {
            MultipartMessageType multipartMessageType = null;

            if (destination == null || destination.Length <= 0)
            {
                throw new BlueviaException("Null or Empty destinations when sending MMS."
                        , ExceptionCode.InvalidArgumentException);
            }

            if (string.IsNullOrWhiteSpace(subject))
            {
                throw new BlueviaException("Null or Empty subject when sending MMS."
                        , ExceptionCode.InvalidArgumentException);
            }

            if (!(string.IsNullOrEmpty(endpoint) && string.IsNullOrEmpty(correlator)))//One of enpoint or correlator is null or empty
            {
                throw new BlueviaException("Both endpoint and correlator parameters,are mandatory when sending message for status notifications."
                        , ExceptionCode.InvalidArgumentException);
            }
            
            //Building the object wich will be serialized to serve as body
            multipartMessageType = MMSTools.CreateMultipartMessageType(destination, subject, originAddress
                , senderName, message, attachments, endpoint, correlator);

            //Selecting the apropiate parser/serializer for the operation:
            serializer = multipartSerializer;
            parser = null;

            
            BaseCreate<string, MultipartMessageType>(
                string.Format(url, Constants.MMSMessageMT_Send)
                , CreateParameters()
                , multipartMessageType
                , CreateHeaders(HttpTools.ContetTypeMultipart));

            //As the usefull info of the response isnt in the body, 
            //lets look for it in the Location header of the response 
            string statusUrl = null;
            response.GetResponseHeaders().TryGetValue("Location", out statusUrl);
            string[] parts = statusUrl.Split(new Char[] { '/' });

            //And return only the statusId
            return parts[8];
        }
Esempio n. 13
0
        /// <summary>
        /// 解析数据
        /// </summary>
        /// <param name="dataSource"></param>
        public void BuildData(MMSDataSource dataSource)
        {
            if (!FileHelper.IsValid(MainDbPath))
            {
                return;
            }

            SqliteContext mainContext   = null;
            string        attendDirPath = MediaDomainPath;

            try
            {
                var rMainDbFile = SqliteRecoveryHelper.DataRecovery(MainDbPath, @"chalib\IOS_Sms\sms.db.charactor",
                                                                    "message,handle,attachment,chat,chat_message_join,chat_handle_join,message_attachment_join", true);
                mainContext = new SqliteContext(rMainDbFile);

                var messageSource = mainContext.Find(new SQLiteString("SELECT * FROM MESSAGE WHERE CACHE_HAS_ATTACHMENTS = 1 and ROWID not null"));
                var allContact    = mainContext.FindByName("HANDLE");
                foreach (var message in messageSource)
                {
                    var sb = new StringBuilder(
                        "select distinct atta.[filename],atta.[mime_type],atta.[created_date] from MESSAGE_ATTACHMENT_JOIN mes ");
                    sb.Append("left join attachment atta on mes.attachment_id = atta.[ROWID] ");
                    sb.AppendFormat("where mes.[message_id] = {0} and atta.filename not null", DynamicConvert.ToSafeString(message.ROWID));
                    var contact = allContact.First(cct => DynamicConvert.ToSafeInt(cct.ROWID) == DynamicConvert.ToSafeInt(message.handle_id));
                    var mms     = new MMS();
                    mms.SenderName = DynamicConvert.ToSafeString(contact.uncanonicalized_id);
                    mms.SendState  = DynamicConvert.ToSafeInt(message.is_from_me) == 1
                                        ? EnumSendState.Send
                                        : EnumSendState.Receive;
                    mms.Date     = DynamicConvert.ToSafeDateTime(message.date);
                    mms.ReadDate = DynamicConvert.ToSafeDateTime(message.date_read);
                    mms.Content  = DynamicConvert.ToSafeString(message.text).TrimStart('?') + Environment.NewLine;
                    // 获取当前消息的所有附件;
                    var attaSource = mainContext.Find(new SQLiteString(sb.ToString()));
                    foreach (var atta in attaSource)
                    {
                        if (FragmentHelper.IsValidFragment(atta))
                        {
                            continue;
                        }
                        string attPath = DynamicConvert.ToSafeString(atta.filename).TrimStart('~').TrimStart('/').Replace("/", @"\");
                        mms.Content += string.Format("{0}{1}", Path.Combine(attendDirPath, attPath), Environment.NewLine);
                    }

                    mms.Content = FragmentHelper.RemoveNullityDataNew(mms.Content.Trim());
                    // 验证内容是否为空
                    if (FragmentHelper.IsEmptyString(mms.Content))
                    {
                        continue;
                    }

                    dataSource.Items.Add(mms);
                }
            }
            finally
            {
                mainContext?.Dispose();
                mainContext = null;
            }
        }
Esempio n. 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Enter the value from the 'App Key' field obtained at developer.att.com in your
        // app account.
        string clientId = "";

        // Enter the value from the 'App Secret' field obtained at developer.att.com
        // in your app account.
        string secretKey = "";

        // Set the fully-qualified domain name to: https://api.att.com
        string fqdn = "https://api.att.com";

        //Set the scope to MMS
        string scope = "MMS";

        //Create the service for requesting an OAuth access token.
        var oauth = new OAuth(fqdn, clientId, secretKey, scope);

        //Get the OAuth access token using client Credential method.
        if (oauth.GetAccessToken(OAuth.AccessTokenType.ClientCredentials))
        {
            // Get access token
            OAuthToken at          = new OAuthToken();
            string     accessToken = at.getAccessToken(oauth.accessTokenJson);

            // Create the service for making the method request.
            var mms = new MMS(fqdn, accessToken);

            // Set params:
            string mmsAddress     = Server.UrlEncode("tel:10000000000") + "&";    //e.g.tel:1234567890
            string mmsMessage     = Server.UrlEncode("msg txt context");
            string mmsFile        = Server.MapPath("~/") + "attachments/att.jpg"; //Attachement path
            string mmsContentType = "image/jpeg";
            string messageId      = "";

            try
            {
                // Make an Make a method call to the MMS API.
                // Method takes:
                // param 1: string mmsAddress (phone number(s))
                // param 2: message text content
                // param 3: file path
                // param 4: multipart content type
                OutboundMessageResponseObj.RootObject SendMMSResponseObj = mms.sendMMS(mmsAddress, mmsMessage, mmsFile, mmsContentType);
                messageId = SendMMSResponseObj.outboundMessageResponse.messageId;
            }
            catch (Exception respex)
            {
                string error = respex.StackTrace;
            }

            try
            {
                // Make an Make a method call to the MMS API.
                // Method takes:
                // param 1: string message id
                DeliveryInfoObj.RootObject getStatusResponseObj = mms.getMMSDeliveryStatus(messageId);
            }
            catch (Exception respex)
            {
                string error = respex.StackTrace;
            }
        }
    }
Esempio n. 15
0
        private void BuildData(MMSDataSource ds, string databasesFilePath)
        {
            var nfile = SqliteRecoveryHelper.DataRecovery(databasesFilePath, "", "canonical_addresses,pdu,part");

            using (var sqliteContext = new SqliteContext(nfile))
            {
                MMS item = null;
                // 获取所有彩信信息;
                List <dynamic> itemsMMS  = sqliteContext.FindByName("pdu").ToList();
                List <dynamic> itemsAddr = sqliteContext.FindByName("canonical_addresses").ToList();
                List <dynamic> itemsPart = sqliteContext.Find(new SQLiteString("select * from part where ct not in ('application/smil')")).ToList();
                foreach (var o in itemsMMS)
                {
                    try
                    {
                        item           = new MMS();
                        item.DataState = DynamicConvert.ToEnumByValue <EnumDataState>(o.XLY_DataType, EnumDataState.Normal);
                        item.SendState = DynamicConvert.ToSafeInt(o.msg_box) == 1
                                             ? EnumSendState.Receive
                                             : EnumSendState.Send;
                        item.Date = DynamicConvert.ToSafeDateTime(o.date);
                        // 获取彩信的扩展;
                        var resultAddr = itemsAddr.Find(addr => DynamicConvert.ToSafeInt(addr.xly_id) == DynamicConvert.ToSafeInt(o.thread_id));
                        if (resultAddr == null)
                        {
                            continue;
                        }
                        item.SenderName = DataParseHelper.NumberToStu(DynamicConvert.ToSafeString(resultAddr.address));

                        // 内容扩展
                        var resultPart = itemsPart.FindAll(part => DynamicConvert.ToSafeInt(part.mid) == DynamicConvert.ToSafeInt(o.xly_id));

                        // 这段方法虽然看起来不爽,但是别删!有个别手机数据结构不同!这里主要兼容; wangxi 2014-7-14 17:14:05
                        if (string.IsNullOrEmpty(item.SenderName) && resultPart.Count != 0)
                        {
                            var num = itemsAddr.Find(addr => DynamicConvert.ToSafeInt(resultPart.First().xly_id) == DynamicConvert.ToSafeInt(addr.xly_id));
                            item.SenderName = DynamicConvert.ToSafeString(num.address);
                            item.SenderName = DataParseHelper.NumberToStu(item.SenderName);
                        }
                        if (resultPart.Count == 0)
                        {
                            item.Content = DynamicConvert.ToSafeString(o.ct_l);
                            item.Type    = EnumColumnType.URL;
                        }
                        else
                        {
                            if (resultPart.Count == 1)
                            {
                                if (DynamicConvert.ToSafeString(resultPart.First().xly_data) != "")
                                {
                                    item.Content = DynamicConvert.ToSafeString(resultPart.First().xly_data).TrimStart('/').Replace("/", @"\");
                                }
                                else
                                {
                                    item.Content = DynamicConvert.ToSafeString(resultPart.First().text);
                                }
                            }
                            if (resultPart.Count > 1)
                            {
                                // 获取所有附加消息;
                                var    allMsg  = resultPart.FindAll(part => DynamicConvert.ToSafeString(part.ct).Equals("text/plain"));
                                var    allPart = resultPart.FindAll(part => DynamicConvert.ToSafeString(part.text) == string.Empty);
                                string message = string.Empty;
                                foreach (var mess in allMsg)
                                {
                                    message += string.Format("{0}{1}", mess.text, Environment.NewLine);
                                }
                                string parts = string.Empty;
                                foreach (var part in allPart)
                                {
                                    if (!string.IsNullOrEmpty(DynamicConvert.ToSafeString(part.xly_data)))
                                    {
                                        string npath = DynamicConvert.ToSafeString(part.xly_data);
                                        parts += string.Format("{0}{1}", npath, Environment.NewLine);
                                    }
                                }
                                item.Content = parts + message;
                            }
                        }
                        item.Content = item.Content.Trim();

                        ds.Items.Add(item);
                    }
                    catch
                    {
                    }
                }
            }
        }