protected AbstractCameraFile( CameraFilePath fullName) { if (string.IsNullOrWhiteSpace(fullName)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(fullName)); } FullName = fullName; Extension = fullName.GetExtension(); if (string.IsNullOrWhiteSpace(Extension)) { throw new ArgumentException($"File {fullName} has no extension", nameof(fullName)); } }
internal Result <ICameraFile> Create( CameraFilePath filePath, IEnumerable <ITag> metadata) { switch (filePath.GetExtension().ToLowerInvariant()) { case ".jpg": case ".jpeg": case ".cr2": return(ImageFile.Create(filePath, metadata)); case ".dng": return(DngImageFile.Create(filePath, metadata)); case ".mp4": case ".mov": return(VideoFile.Create(filePath, metadata)); default: throw new InvalidPathException($"Unknown file type {filePath}"); } }