public Metadata Create(string destination, string fileName, string exifToolPath) { var fullPath = Path.Combine(destination, fileName); var document = new XDocument(GetFullXml(fullPath, exifToolPath)); var fileSize = (string)document.Descendants(SystemNamespace + "FileSize").FirstOrDefault(); var fileType = (string)document.Descendants(FileNamespace + "FileType").FirstOrDefault(); var mimeType = (string)document.Descendants(FileNamespace + "MIMEType").FirstOrDefault(); var type = mimeType.ToLower().Split('/')[0]; switch (type) { case "image": builder = new ImageMetadataBuilder(document, fileSize, fileType, mimeType); builder.SetCreateDate(); builder.SetModifyDate(); builder.SetImageWidth(); builder.SetImageHeight(); builder.SetImageSize(); break; case "document": builder = new DocumentMetadataBuilder(document, fileSize, fileType, mimeType); builder.SetCreateDate(); builder.SetModifyDate(); break; } return(builder.GetMetadata()); }