예제 #1
0
    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));
        }
    }
예제 #2
0
    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}");
        }
    }