Exemple #1
0
        public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element)
        {
            if (element == null || element is CollectionInfo)
            {
                return(null);
            }

            Mediachase.IBN.Business.EMail.EMailMessageInfo.AttachmentData entry =
                element.Tag as Mediachase.IBN.Business.EMail.EMailMessageInfo.AttachmentData;

            return(new MemoryStream(entry.Data));
        }
Exemple #2
0
        protected override ResourceInfo GetResourceInfo(WebDavTicket ticket)
        {
            ResourceInfo             retVal  = new ResourceInfo();
            EmailStorageAbsolutePath absPath = ticket.AbsolutePath as EmailStorageAbsolutePath;

            if (absPath == null)
            {
                throw new ArgumentException("absPath");
            }

            EMailMessageRow row       = new EMailMessageRow(absPath.EmailMsgId);
            MemoryStream    memStream = new MemoryStream(row.EmlMessage.Length);

            memStream.Write(row.EmlMessage, 0, row.EmlMessage.Length);
            memStream.Position = 0;

            Pop3Message message         = new Pop3Message(memStream);
            int         attachmentIndex = absPath.EmailAttachmentIndex;

            Mediachase.IBN.Business.EMail.EMailMessageInfo.AttachmentData entry =
                EMailMessageInfo.GetAttachment(message.MimeEntries, ref attachmentIndex);

            if (entry != null)
            {
                retVal.AbsolutePath = ticket.ToString();
                retVal.Tag          = entry;
                retVal.Name         = entry.FileName;
                //Fix ET:26-11-2008 Solve trouble inconsistency Content-Type email attachment and file extension
                //try first get Content-Type by file extension
                retVal.ContentType = ContentTypeResolver.Resolve(Path.GetExtension(entry.FileName));
                if (String.IsNullOrEmpty(retVal.ContentType))
                {
                    //otherwise set ContentType as ContentType email attachment
                    retVal.ContentType = entry.ContentType;
                }
                retVal.ContentLength = entry.Data.Length;
                retVal.ParentName    = "root";
                DateTime created = Database.DBCommon.GetLocalDate(Security.CurrentUser.TimeZoneId, row.Created);
                retVal.Created  = created;
                retVal.Modified = created;
            }

            return(retVal);
        }