protected override List<ExportError> ExportConversationAttachments(IConversation conversation, string exportFilename, out IAttachmentExportLocator exportLocator)
        {
            List<ExportError> exportErrors = new List<ExportError>();
            string exportBasePath = Path.GetDirectoryName(exportFilename);
            AttachmentExportLocator attachmentExportLocator = new AttachmentExportLocator(exportBasePath);
            string attachmentDirectoryPath = null;
            bool exportedVideoAttachment = false;
            bool exportedAudioAttachment = false;

            foreach (IConversationMessage message in conversation)
            {
                if (!message.HasAttachments())
                {
                    continue;
                }

                if (attachmentDirectoryPath == null)
                {
                    string attachmentDirectoryName = GenerateAttachmentExportDirectoryName(exportFilename);
                    attachmentDirectoryPath = Path.Combine(exportBasePath, attachmentDirectoryName);
                    attachmentDirectoryPath = FileCreator.CreateNewDirectoryWithRenameAttempts(attachmentDirectoryPath, _exportFileSystem, MaxRenameAttempts);
                }

                foreach (IMessageAttachment attachment in message.Attachments)
                {
                    try
                    {
                        string exportedPath = ExportMessageAttachment(attachment, attachmentDirectoryPath);
                        attachmentExportLocator.AddAttachmentExportLocation(attachment, exportedPath);

                        if (attachment.Type == AttachmentType.Video)
                        {
                            exportedVideoAttachment = true;
                        }
                        else if (attachment.Type == AttachmentType.Audio)
                        {
                            exportedAudioAttachment = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        exportErrors.Add(new ExportError(conversation, ex));
                    }
                }
            }

            if (exportedVideoAttachment)
            {
                string videoIconPath = PlaceVideoIconFile(attachmentDirectoryPath);
                attachmentExportLocator.AddFileExportLocation(VideoIconOutputFilename, videoIconPath);
            }
            if (exportedAudioAttachment)
            {
                string audioIconPath = PlaceAudioIconFile(attachmentDirectoryPath);
                attachmentExportLocator.AddFileExportLocation(AudioIconOutputFilename, audioIconPath);
            }

            exportLocator = attachmentExportLocator;
            return exportErrors;
        }
        public void RenderMessageWithAttachmentTest()
        {
            string renderedExpected = @"<p>
            <span class=""date"">Sunday, Sep 9, 2012</span><br />
            <span style=""color:rgb(0,0,210);""><span class=""senderName"">Frankie Coolpics</span> <span class=""timestamp"">(<span dir=""ltr"" lang=""en"">8:34:15 PM</span>)</span>: </span>Check this shit out!<br />
            <a href=""FrankieCoolpics_attachments\IMG_0036.JPG"" target=""_blank""><img class=""attachmentImage"" src=""FrankieCoolpics_attachments\IMG_0036.JPG"" /></a><br />
            <span style=""color:rgb(210,0,0);""><span class=""senderName"">Me</span> <span class=""timestamp"">(<span dir=""ltr"" lang=""en"">8:34:30 PM</span>)</span>: </span>Crazy!
            </p>
            ";
            IDisplayOptionsReadOnly displayOptions = new MockDisplayOptions();
            AttachmentExportLocator attachmentExportLocator = new AttachmentExportLocator( @"C:\backup\export");
            attachmentExportLocator.AddFileExportLocation(@"C:\fakepath\backup\082308302382", @"C:\backup\export\FrankieCoolpics_attachments\IMG_0036.JPG");
            IConversation conversation = DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.FrankieCoolPicsCell);
            IConversationRenderer renderer = new ConversationRendererHtml(displayOptions, conversation, attachmentExportLocator);

            string renderedActual = renderer.RenderMessagesAsString(ConversationRendererBase.RenderAllMessages);
            Assert.AreEqual(renderedExpected, renderedActual);
        }
        private List<ExportError> DoAttachmentExport(IConversation conversation, IDisplayOptionsReadOnly displayOptions, string exportFilename, out IAttachmentExportLocator exportLocator)
        {
            List<ExportError> exportErrors;
            if (displayOptions.LoadMmsAttachments)
            {
                exportErrors = ExportConversationAttachments(conversation, exportFilename, out exportLocator);
            }
            else
            {
                exportErrors = new List<ExportError>();
                exportLocator = new AttachmentExportLocator(null);
            }

            return exportErrors;
        }