private IEnumerable <string> GetSupportedFiles(IDataObject data) { var result = new List <string>(); if (data.GetDataPresent(DataFormats.FileDrop)) { // Note that you can have more than one file... string[] files = (string[])data.GetData(DataFormats.FileDrop); if (files == null || !files.Any()) { return(result); } foreach (var file in files) { var ext = Path.GetExtension(file); if (!string.IsNullOrEmpty(ext) && _mediaProviderService.IsFileExtensionSupported(ext)) { result.Add(file); } } } Log.Logger.Verbose($"Found {result.Count} supported files in drag-and-drop operation"); return(result); }
private string GetSupportedFile(string file) { var ext = Path.GetExtension(file); if (string.IsNullOrEmpty(ext) || !_mediaProviderService.IsFileExtensionSupported(ext)) { return(null); } return(file); }
private bool IsMediaFileUrl(string uri) { var ext = Path.GetExtension(uri); return(!string.IsNullOrEmpty(ext) && _mediaProviderService.IsFileExtensionSupported(ext)); }