public static bool LoadMediaList <T>(string fullPath, MediaType type, out T list) where T : IEnumerable <MediaBaseModel> { bool result = true; list = default(T); if (File.Exists(fullPath)) { if (type == MediaType.Image) { result = ImageService.LoadImagesFromFile <T>(fullPath, out list); } else if (type == MediaType.Video) { result = VideoService.LoadVideoList(fullPath, out list); } else { result = false; } } return(result); }
public static bool SaveMediaList <T>(T list, string fullPath, MediaType type) where T : IEnumerable <MediaBaseModel> { bool result; if (list == null || !list.Any()) { result = false; } else if (type == MediaType.Image) { result = ImageService.Save((IEnumerable <ImageModel>)list, fullPath); } else if (type == MediaType.Video) { result = VideoService.SaveVideoList((IEnumerable <VideoModel>)list, fullPath); } else { result = false; } return(result); }