private TaskItem BuildContent(ITaskItem folder, Document document, PathMapping folderMapping) { PathMapping documentPath = new PathMapping(folderMapping, new TaskItem().FillMetadata(document)); string targetFile = documentPath.MappedPath; TaskItem content = new TaskItem(targetFile); folder.CopyMetadataTo(content, FolderMetadataPrefix ?? "Folder"); content.FillMetadata(documentPath); content.FillMetadata(document); content.RequireParentDirectory(Log); if (content.Exists()) { DateTime updated = File.GetLastWriteTime(targetFile); Log.LogMessage(MessageImportance.Normal, "Exists at \"{0}\"", targetFile); if (updated != document.Updated) { Log.LogMessage(MessageImportance.Low, "Updated - Local: {0} Remote: {1}", updated, document.Updated); } else { Log.LogMessage(MessageImportance.Low, "Updated - {0}", document.Updated); } } else { Log.LogMessage(MessageImportance.Normal, "Detected new document"); } if (document.DocumentEntry != null && document.DocumentEntry.Content != null && document.DocumentEntry.Content.Src != null) { content.SetMetadata("ExportUri", document.DocumentEntry.Content.Src.ToString()); } content.Save(Log, document.Updated); return(content); }