/// <summary>
        /// Given the file path to the media, it will determine if the file extenstion is one of the supported image file extensions or video file extensions, and return string "image" or "video", respectively
        /// </summary>
        /// <param name="mediaPath"></param>
        /// <returns></returns>
        private MediaType GetInstructionalMediaType(string mediaPath)
        {
            // TODO: Import all of the supported extensions from config.json, and store it in a scope outside of this function and page so it doesn't parse a json tree every time this is run

            // Strip the file path to be just the file extension
            string mediaType = Path.GetExtension(mediaPath);

            // Check if the path ends in a supported image extension
            if (SupportedImageExtensions.Any(x => x.Equals(mediaType, StringComparison.OrdinalIgnoreCase)))
            {
                return(MediaType.Image);
            }
            if (SupportedVideoExtensions.Any(x => x.Equals(mediaType, StringComparison.OrdinalIgnoreCase)))
            {
                return(MediaType.Video);
            }

            return(MediaType.None);
        }
Exemplo n.º 2
0
        private void SelectedFile(object obj)
        {
            SelectedPhotoPath = null;
            SelectedGIFPath   = null;
            SelectedVideoPath = null;

            var selectedFile = obj as Media;

            if (selectedFile.Path.Contains(".jpg"))
            {
                SelectedPhotoPath = selectedFile.Path;
            }
            else if (selectedFile.Path.Contains(".gif"))
            {
                SelectedGIFPath = selectedFile.Path;
            }
            else if (SupportedVideoExtensions.Contains(selectedFile.Path.Split('.')[1]))
            {
                SelectedVideoPath = selectedFile.Path;
            }
        }