예제 #1
0
        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);
        }
예제 #2
0
        private string GetSupportedFile(string file)
        {
            var ext = Path.GetExtension(file);

            if (string.IsNullOrEmpty(ext) || !_mediaProviderService.IsFileExtensionSupported(ext))
            {
                return(null);
            }

            return(file);
        }
예제 #3
0
        private bool IsMediaFileUrl(string uri)
        {
            var ext = Path.GetExtension(uri);

            return(!string.IsNullOrEmpty(ext) && _mediaProviderService.IsFileExtensionSupported(ext));
        }