public static Texture2D LoadModGalleryImage(int modId, string imageFileName, ModGalleryImageSize size) { string imageFilePath = CacheClient.GenerateModGalleryImageFilePath(modId, imageFileName, size); Texture2D imageTexture = CacheClient.ReadImageFile(imageFilePath); return(imageTexture); }
/// <summary>Retrieves a mod gallery image from the cache.</summary> public static Texture2D LoadModGalleryImage(int modId, string imageFileName, ModGalleryImageSize size) { Debug.Assert(!String.IsNullOrEmpty(imageFileName)); string imageFilePath = CacheClient.GenerateModGalleryImageFilePath(modId, imageFileName, size); Texture2D imageTexture = IOUtilities.ReadImageFile(imageFilePath); return(imageTexture); }
public static void SaveModGalleryImage(int modId, string imageFileName, ModGalleryImageSize size, Texture2D imageTexture) { Debug.Assert(modId > 0, "[mod.io] Cannot cache a mod image without a mod id"); string imageFilePath = CacheClient.GenerateModGalleryImageFilePath(modId, imageFileName, size); CacheClient.WritePNGFile(imageFilePath, imageTexture); }
/// <summary>Stores a mod gallery image in the cache.</summary> public static bool SaveModGalleryImage(int modId, string imageFileName, ModGalleryImageSize size, Texture2D imageTexture) { Debug.Assert(!String.IsNullOrEmpty(imageFileName)); Debug.Assert(imageTexture != null); string imageFilePath = CacheClient.GenerateModGalleryImageFilePath(modId, imageFileName, size); return(IOUtilities.WritePNGFile(imageFilePath, imageTexture)); }
/// <summary>Stores a mod gallery image in the cache.</summary> public static bool SaveModGalleryImage(int modId, string imageFileName, ModGalleryImageSize size, Texture2D imageTexture) { Debug.Assert(!String.IsNullOrEmpty(imageFileName)); Debug.Assert(imageTexture != null); string imageFilePath = CacheClient.GenerateModGalleryImageFilePath(modId, imageFileName, size); byte[] imageData = imageTexture.EncodeToPNG(); return(LocalDataStorage.WriteFile(imageFilePath, imageData)); }
/// <summary>Retrieves a mod gallery image from the cache.</summary> public static Texture2D LoadModGalleryImage(int modId, string imageFileName, ModGalleryImageSize size) { Debug.Assert(!String.IsNullOrEmpty(imageFileName)); string imageFilePath = CacheClient.GenerateModGalleryImageFilePath(modId, imageFileName, size); byte[] imageData; if (LocalDataStorage.ReadFile(imageFilePath, out imageData) && imageData != null) { return(IOUtilities.ParseImageData(imageData)); } else { return(null); } }