protected void UpdateRemovableDriveHandler() { _removableDriveHandler = VideoDriveHandler.TryCreateVideoDriveHandler(_driveInfo, Consts.NECESSARY_VIDEO_MIAS) ?? AudioCDDriveHandler.TryCreateAudioCDDriveHandler(_driveInfo) ?? MultimediaDriveHandler.TryCreateMultimediaCDDriveHandler(_driveInfo, Consts.NECESSARY_VIDEO_MIAS, Consts.NECESSARY_IMAGE_MIAS, Consts.NECESSARY_AUDIO_MIAS) ?? (IRemovableDriveHandler) new UnknownRemovableDriveHandler(_driveInfo); }
/// <summary> /// Examines the media in the given <paramref name="drive"/> and auto-plays the inserted media. Depending on the type of the /// inserted media, different play modes are choosen. /// </summary> /// <param name="drive">Drive to be examined. Format: <c>D:</c>.</param> protected void ExamineVolume(string drive) { if (string.IsNullOrEmpty(drive)) { return; } DriveInfo driveInfo = new DriveInfo(drive); VideoDriveHandler vdh; AudioCDDriveHandler acddh; MultimediaDriveHandler mcddh; if ((vdh = VideoDriveHandler.TryCreateVideoDriveHandler(driveInfo, Consts.NECESSARY_VIDEO_MIAS)) != null) { PlayItemsModel.CheckQueryPlayAction(vdh.VideoItem); } else if ((acddh = AudioCDDriveHandler.TryCreateAudioCDDriveHandler(driveInfo)) != null) { PlayItemsModel.CheckQueryPlayAction(() => acddh.GetAllMediaItems(), AVType.Audio); } else if ((mcddh = MultimediaDriveHandler.TryCreateMultimediaCDDriveHandler(driveInfo, Consts.NECESSARY_VIDEO_MIAS, Consts.NECESSARY_AUDIO_MIAS, Consts.NECESSARY_IMAGE_MIAS)) != null) { switch (mcddh.MediaType) { case MultiMediaType.Video: case MultiMediaType.Image: PlayItemsModel.CheckQueryPlayAction(() => mcddh.GetAllMediaItems(), AVType.Video); break; case MultiMediaType.Audio: PlayItemsModel.CheckQueryPlayAction(() => mcddh.GetAllMediaItems(), AVType.Audio); break; case MultiMediaType.Diverse: PlayItemsModel.CheckQueryPlayAction(() => mcddh.GetAllMediaItems()); break; } } return; }
/// <summary> /// Examines the media in the given <paramref name="drive"/> and auto-plays the inserted media. Depending on the type of the /// inserted media, different play modes are choosen. /// </summary> /// <param name="drive">Drive to be examined. Format: <c>D:</c>.</param> protected AVType ExamineVolume(string drive) { if (string.IsNullOrEmpty(drive)) { return(AVType.None); } DriveInfo driveInfo = new DriveInfo(drive); VideoDriveHandler vdh; AudioCDDriveHandler acddh; MultimediaDriveHandler mcddh; if ((vdh = VideoDriveHandler.TryCreateVideoDriveHandler(driveInfo, Consts.NECESSARY_VIDEO_MIAS)) != null) { var items = new[] { vdh.VideoItem }; _removableMediaItems.AddOrUpdate(drive, items, (d, e) => items); return(AVType.Video); } else if ((acddh = AudioCDDriveHandler.TryCreateAudioCDDriveHandler(driveInfo)) != null) { var items = acddh.GetAllMediaItems(); _removableMediaItems.AddOrUpdate(drive, items, (d, e) => items); return(AVType.Audio); } else if ((mcddh = MultimediaDriveHandler.TryCreateMultimediaCDDriveHandler(driveInfo, Consts.NECESSARY_VIDEO_MIAS, Consts.NECESSARY_AUDIO_MIAS, Consts.NECESSARY_IMAGE_MIAS)) != null) { var items = mcddh.GetAllMediaItems(); _removableMediaItems.AddOrUpdate(drive, items, (d, e) => items); switch (mcddh.MediaType) { case MultiMediaType.Video: case MultiMediaType.Image: return(AVType.Video); case MultiMediaType.Audio: return(AVType.Audio); } } return(AVType.None); }