public static Texture2D ReadImageFile(string filePath) { Texture2D parsed = null; byte[] data = LoadBinaryFile(filePath); if (data != null) { parsed = IOUtilities.ParseImageData(data); } return(parsed); }
public static Texture2D ReadImageFile(string filePath) { Texture2D parsed = null; bool success = false; byte[] data = null; success = LocalDataStorage.ReadFile(filePath, out data); if (success) { parsed = IOUtilities.ParseImageData(data); } return(parsed); }
/// <summary>Retrieves a user's avatar from the cache.</summary> public static Texture2D LoadUserAvatar(int userId, UserAvatarSize size) { string avatarFilePath = CacheClient.GenerateUserAvatarFilePath(userId, size); byte[] imageData; if (LocalDataStorage.ReadFile(avatarFilePath, out imageData) && imageData != null) { return(IOUtilities.ParseImageData(imageData)); } else { return(null); } }
/// <summary>Retrieves a mod logo from the cache.</summary> public static Texture2D LoadModLogo(int modId, LogoSize size) { string logoFilePath = CacheClient.GenerateModLogoFilePath(modId, size); byte[] imageData; if (LocalDataStorage.ReadFile(logoFilePath, out imageData) && imageData != null) { return(IOUtilities.ParseImageData(imageData)); } else { return(null); } }
public static bool TryReadImageFile(string filePath, out Texture2D texture) { Texture2D parsed = null; bool success = false; byte[] data = null; success = TryLoadBinaryFile(filePath, out data); if (success) { parsed = IOUtilities.ParseImageData(data); } texture = parsed; return(success); }
/// <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); } }
/// <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); } }