Exemple #1
0
        public static byte[] LoadBinaryFile(string filePath)
        {
            byte[] data = null;

            LocalDataStorage.ReadFile(filePath, out data);

            return(data);
        }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        /// <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);
            }
        }
Exemple #6
0
        /// <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);
            }
        }
Exemple #7
0
        /// <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);
            }
        }
Exemple #8
0
        /// <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);
            }
        }