Bend.EmailIndexerTest.EmailInjector.parse_msg C# (CSharp) Method

parse_msg() public method

public parse_msg ( LayerWriteGroup txwg, string docid, string msgtxt, int &numwords ) : void
txwg LayerWriteGroup
docid string
msgtxt string
numwords int
return void
        public void parse_msg(LayerWriteGroup txwg, string docid, string msgtxt, out int numwords)
        {
            if (msgtxt.Length > 4 * 1024) {
                msgtxt = msgtxt.Substring(0, 4 * 1024 - 1);
            }
            // db.setValueParsed(".zdata/doc/" + docid, msgtxt);
            // gui.debugDump(db);

            #if true
                // sharptools
                SharpMessage msg = new anmar.SharpMimeTools.SharpMessage(msgtxt);
                System.Console.WriteLine("Subject: " + msg.Subject);

                indexer.index_document(txwg, docid, msg.Body, out numwords);
            #else
                // LumiSoft
                Mime msg = LumiSoft.Net.Mime.Mime.Parse(System.Text.Encoding.Default.GetBytes(msgtxt));
                System.Console.WriteLine("Subject: " + msg.MainEntity.Subject);
                indexer.index_document(txwg, docid, msg.MainEntity.DataText, out numwords);
            #endif

            //foreach (SharpAttachment msgpart in msg.Attachments) {
            //    if (msgpart.MimeTopLevelMediaType == MimeTopLevelMediaType.text &&
            //        msgpart.MimeMediaSubType == "plain") {
            //        System.Console.WriteLine("Attachment: " + msgpart.Size);
            //   }
            //}
        }