public static byte[] LoadBinaryFile(string filePath) { byte[] data = null; LocalDataStorage.ReadFile(filePath, out data); return(data); }
/// <summary>Retrieves a mod binary's ZipFile data from the cache.</summary> public static byte[] LoadModBinaryZip(int modId, int modfileId) { string filePath = GenerateModBinaryZipFilePath(modId, modfileId); byte[] zipData; LocalDataStorage.ReadFile(filePath, out zipData); return(zipData); }
public static bool TryLoadBinaryFile(string filePath, out byte[] output) { bool success = false; byte[] data = null; success = LocalDataStorage.ReadFile(filePath, out data); output = data; return(success); }
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); } }
/// <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); } }