/// <summary>Retrieves a YouTube thumbnail from the cache.</summary> public static Texture2D LoadModYouTubeThumbnail(int modId, string youTubeId) { Debug.Assert(!String.IsNullOrEmpty(youTubeId)); string thumbnailFilePath = CacheClient.GenerateModYouTubeThumbnailFilePath(modId, youTubeId); Texture2D thumbnailTexture = IOUtilities.ReadImageFile(thumbnailFilePath); return(thumbnailTexture); }
/// <summary>Stores a YouTube thumbnail in the cache.</summary> public static bool SaveModYouTubeThumbnail(int modId, string youTubeId, Texture2D thumbnail) { Debug.Assert(!String.IsNullOrEmpty(youTubeId)); Debug.Assert(thumbnail != null); string thumbnailFilePath = CacheClient.GenerateModYouTubeThumbnailFilePath(modId, youTubeId); return(IOUtilities.WritePNGFile(thumbnailFilePath, thumbnail)); }
/// <summary>Stores a YouTube thumbnail in the cache.</summary> public static bool SaveModYouTubeThumbnail(int modId, string youTubeId, Texture2D thumbnail) { Debug.Assert(!String.IsNullOrEmpty(youTubeId)); Debug.Assert(thumbnail != null); string thumbnailFilePath = CacheClient.GenerateModYouTubeThumbnailFilePath(modId, youTubeId); byte[] imageData = thumbnail.EncodeToPNG(); return(LocalDataStorage.WriteFile(thumbnailFilePath, imageData)); }
/// <summary>Retrieves a YouTube thumbnail from the cache.</summary> public static Texture2D LoadModYouTubeThumbnail(int modId, string youTubeId) { Debug.Assert(!String.IsNullOrEmpty(youTubeId)); string thumbnailFilePath = CacheClient.GenerateModYouTubeThumbnailFilePath(modId, youTubeId); byte[] imageData; if (LocalDataStorage.ReadFile(thumbnailFilePath, out imageData) && imageData != null) { return(IOUtilities.ParseImageData(imageData)); } else { return(null); } }