/// <summary>Stores a user's avatar in the cache.</summary> public static bool SaveUserAvatar(int userId, UserAvatarSize size, Texture2D avatarTexture) { Debug.Assert(avatarTexture != null); string avatarFilePath = CacheClient.GenerateUserAvatarFilePath(userId, size); return(IOUtilities.WritePNGFile(avatarFilePath, avatarTexture)); }
/// <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 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 logo in the cache with the given fileName.</summary> public static bool SaveModLogo(int modId, string fileName, LogoSize size, Texture2D logoTexture) { Debug.Assert(!String.IsNullOrEmpty(fileName)); Debug.Assert(logoTexture != null); string logoFilePath = CacheClient.GenerateModLogoFilePath(modId, size); bool isSuccessful = IOUtilities.WritePNGFile(logoFilePath, logoTexture); // - Update the versioning info - var versionInfo = CacheClient.GetModLogoVersionFileNames(modId); if (versionInfo == null) { versionInfo = new Dictionary <LogoSize, string>(); } versionInfo[size] = fileName; isSuccessful = (IOUtilities.WriteJsonObjectFile(GenerateModLogoVersionInfoFilePath(modId), versionInfo) && isSuccessful); return(isSuccessful); }