Exemple #1
0
        /// <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);

            bool   success      = false;
            string logoFilePath = CacheClient.GenerateModLogoFilePath(modId, size);

            byte[] imageData = logoTexture.EncodeToPNG();

            // write file
            if (LocalDataStorage.WriteFile(logoFilePath, imageData))
            {
                success = true;

                // - Update the versioning info -
                var versionInfo = CacheClient.GetModLogoVersionFileNames(modId);
                if (versionInfo == null)
                {
                    versionInfo = new Dictionary <LogoSize, string>();
                }
                versionInfo[size] = fileName;
                LocalDataStorage.WriteJSONFile(GenerateModLogoVersionInfoFilePath(modId), versionInfo);
            }

            return(success);
        }
Exemple #2
0
        /// <summary>Stores a mod's statistics in the cache.</summary>
        public static bool SaveModStatistics(ModStatistics stats)
        {
            Debug.Assert(stats != null);
            string statsFilePath = GenerateModStatisticsFilePath(stats.modId);

            return(LocalDataStorage.WriteJSONFile(statsFilePath, stats));
        }
Exemple #3
0
        public static bool SaveUserProfile(UserProfile userProfile)
        {
            Debug.Assert(userProfile != null);

            string filePath = CacheClient.GenerateUserProfileFilePath(userProfile.id);

            return(LocalDataStorage.WriteJSONFile(filePath, userProfile));
        }
Exemple #4
0
        /// <summary>Stores a mod's profile in the cache.</summary>
        public static bool SaveModProfile(ModProfile profile)
        {
            Debug.Assert(profile != null);

            string path = GenerateModProfileFilePath(profile.id);

            return(LocalDataStorage.WriteJSONFile(path, profile));
        }
Exemple #5
0
        /// <summary>Stores a mod team's data in the cache.</summary>
        public static bool SaveModTeam(int modId,
                                       List <ModTeamMember> modTeam)
        {
            Debug.Assert(modTeam != null);

            string filePath = CacheClient.GenerateModTeamFilePath(modId);

            return(LocalDataStorage.WriteJSONFile(filePath, modTeam));
        }
Exemple #6
0
 public static bool WriteJsonObjectFile <T>(string filePath,
                                            T jsonObject)
 {
     return(LocalDataStorage.WriteJSONFile <T>(filePath, jsonObject));;
 }
Exemple #7
0
        /// <summary>Stores the game's profile in the cache.</summary>
        public static bool SaveGameProfile(GameProfile profile)
        {
            Debug.Assert(profile != null);

            return(LocalDataStorage.WriteJSONFile(gameProfileFilePath, profile));
        }