/// <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); }
/// <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)); }
public static bool SaveUserProfile(UserProfile userProfile) { Debug.Assert(userProfile != null); string filePath = CacheClient.GenerateUserProfileFilePath(userProfile.id); return(LocalDataStorage.WriteJSONFile(filePath, userProfile)); }
/// <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)); }
/// <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)); }
public static bool WriteJsonObjectFile <T>(string filePath, T jsonObject) { return(LocalDataStorage.WriteJSONFile <T>(filePath, jsonObject));; }
/// <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)); }