/// <summary> /// Creates a <see cref="MultimediaDriveHandler"/> if the drive of the given <paramref name="driveInfo"/> contains one or more /// media item files. /// </summary> /// <param name="driveInfo">Drive info object for the drive to examine.</param> /// <param name="videoMIATypeIds">Media item aspect types to be extracted from the video items. The given MIAs will be present /// in all created instance's video items.</param> /// <param name="imageMIATypeIds">Media item aspect types to be extracted from the image items. The given MIAs will be present /// in all created instance's image items.</param> /// <param name="audioMIATypeIds">Media item aspect types to be extracted from the audio items. The given MIAs will be present /// in all created instance's audio items.</param> /// <returns><see cref="MultimediaDriveHandler"/> instance for the multimedia CD/DVD/BD or <c>null</c>, if the given drive doesn't contain /// media items.</returns> public static MultimediaDriveHandler TryCreateMultimediaCDDriveHandler(DriveInfo driveInfo, IEnumerable <Guid> videoMIATypeIds, IEnumerable <Guid> imageMIATypeIds, IEnumerable <Guid> audioMIATypeIds) { string drive = driveInfo.Name; if (string.IsNullOrEmpty(drive) || drive.Length < 2) { return(null); } drive = drive.Substring(0, 2); // Clip potential '\\' at the end string directory = drive + "\\"; ICollection <MediaItem> mediaItems; MultiMediaType mediaType; return((mediaType = MultimediaDirectory.DetectMultimedia( directory, videoMIATypeIds, imageMIATypeIds, audioMIATypeIds, out mediaItems)) == MultiMediaType.None ? null : new MultimediaDriveHandler(driveInfo, mediaItems, mediaType)); }
/// <summary> /// Creates a <see cref="MultimediaDriveHandler"/> if the drive of the given <paramref name="driveInfo"/> contains one or more /// media item files. /// </summary> /// <param name="driveInfo">Drive info object for the drive to examine.</param> /// <param name="videoMIATypeIds">Media item aspect types to be extracted from the video items. The given MIAs will be present /// in all created instance's video items.</param> /// <param name="imageMIATypeIds">Media item aspect types to be extracted from the image items. The given MIAs will be present /// in all created instance's image items.</param> /// <param name="audioMIATypeIds">Media item aspect types to be extracted from the audio items. The given MIAs will be present /// in all created instance's audio items.</param> /// <returns><see cref="MultimediaDriveHandler"/> instance for the multimedia CD/DVD/BD or <c>null</c>, if the given drive doesn't contain /// media items.</returns> public static MultimediaDriveHandler TryCreateMultimediaCDDriveHandler(DriveInfo driveInfo, IEnumerable <Guid> videoMIATypeIds, IEnumerable <Guid> imageMIATypeIds, IEnumerable <Guid> audioMIATypeIds) { string drive = driveInfo.Name; if (string.IsNullOrEmpty(drive) || drive.Length < 2) { return(null); } drive = drive.Substring(0, 2); // Clip potential '\\' at the end string directory = drive + "\\"; MultiMediaType mediaType = MultimediaDirectory.DetectMultimedia(directory, videoMIATypeIds, imageMIATypeIds, audioMIATypeIds); if (mediaType == MultiMediaType.None) { return(null); } IEnumerable <Guid> necessaryMIATypeIds = Consts.NECESSARY_BROWSING_MIAS; IEnumerable <Guid> optionalMIATypeIds = videoMIATypeIds.Union(imageMIATypeIds).Union(audioMIATypeIds).Except(necessaryMIATypeIds); return(new MultimediaDriveHandler(driveInfo, necessaryMIATypeIds, optionalMIATypeIds, mediaType)); }