static List <string> filtersForMediaType(MediaFileTypes fileType) { System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection(); switch (fileType) { case MediaFileTypes.Image: sc = Settings.Default.ImageFileExtensions; break; case MediaFileTypes.Music: sc = Settings.Default.MusicFileExtensions; break; case MediaFileTypes.Video: sc = Settings.Default.VideoFileExtensions; break; default: break; } List <string> Filters = new List <string>(); foreach (string strExt in sc) { Filters.Add("*." + strExt); } return(Filters); }
public async Task AddByDownload(string url) { var data = await mClient.DownloadDataTaskAsync(url); var contentMimeType = mClient.ResponseHeaders[HttpResponseHeader.ContentType]; items.Add(url, new AlbumArtFile { Data = data, DownloadUri = new Uri(url), FileType = MediaFileTypes.ByMimeType(contentMimeType) }); }
/// <summary> /// Browse to a library path; use filters for specified media type and optionally attempt to get the duration of the files /// </summary> /// <param name="FullPath"></param> /// <param name="fileType"></param> /// <param name="getMediaDuration"></param> /// <returns></returns> public static FileBrowseResult BrowsePath(string FullPath, MediaFileTypes fileType, bool getMediaDuration) { List <string> Filters = filtersForMediaType(fileType); return(BrowsePath(FullPath, Filters, getMediaDuration)); }
/// <summary> /// Browse to a library path; use filters for specified media type and get duration for any non-image media type /// </summary> /// <param name="FullPath"></param> /// <param name="fileType"></param> /// <returns></returns> public static FileBrowseResult BrowsePath(string FullPath, MediaFileTypes fileType) { List <string> Filters = filtersForMediaType(fileType); return(BrowsePath(FullPath, Filters, (fileType != MediaFileTypes.Image))); }
/// <summary> /// Browse to a library path; use filters for specified media type and optionally attempt to get the duration of the files /// </summary> /// <param name="FullPath"></param> /// <param name="fileType"></param> /// <param name="getMediaDuration"></param> /// <returns></returns> public static FileBrowseResult BrowsePath(string FullPath, MediaFileTypes fileType, bool getMediaDuration) { List<string> Filters = filtersForMediaType(fileType); return BrowsePath(FullPath, Filters, getMediaDuration); }
/// <summary> /// Browse to a library path; use filters for specified media type and get duration for any non-image media type /// </summary> /// <param name="FullPath"></param> /// <param name="fileType"></param> /// <returns></returns> public static FileBrowseResult BrowsePath(string FullPath, MediaFileTypes fileType) { List<string> Filters = filtersForMediaType(fileType); return BrowsePath(FullPath, Filters, (fileType != MediaFileTypes.Image)); }
static List<string> filtersForMediaType(MediaFileTypes fileType) { System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection(); switch (fileType) { case MediaFileTypes.Image: sc = Settings.Default.ImageFileExtensions; break; case MediaFileTypes.Music: sc = Settings.Default.MusicFileExtensions; break; case MediaFileTypes.Video: sc = Settings.Default.VideoFileExtensions; break; default: break; } List<string> Filters = new List<string>(); foreach (string strExt in sc) { Filters.Add("*." + strExt); } return Filters; }