public static UserProfile LoadUserProfile(int userId) { string filePath = CacheClient.GenerateUserProfileFilePath(userId); var userProfile = CacheClient.ReadJsonObjectFile <UserProfile>(filePath); return(userProfile); }
public static IEnumerable <UserProfileStub> IterateAllUserProfiles() { string profileDirectory = CacheClient.GetCacheDirectory() + "users/"; if (Directory.Exists(profileDirectory)) { string[] userFiles; try { userFiles = Directory.GetFiles(profileDirectory); } catch (Exception e) { string warningInfo = ("[mod.io] Failed to read user profile directory." + "\nDirectory: " + profileDirectory + "\n\n"); Debug.LogWarning(warningInfo + Utility.GenerateExceptionDebugString(e)); userFiles = new string[0]; } foreach (string profileFilePath in userFiles) { var profile = CacheClient.ReadJsonObjectFile <UserProfileStub>(profileFilePath); if (profile != null) { yield return(profile); } } } }
public static IEnumerable <ModProfile> AllModProfiles() { string profileDirectory = CacheClient._cacheDirectory + "mods/"; if (Directory.Exists(profileDirectory)) { string[] modDirectories; try { modDirectories = Directory.GetDirectories(profileDirectory); } catch (Exception e) { string warningInfo = ("[mod.io] Failed to read mod profile directory." + "\nDirectory: " + profileDirectory + "\n\n"); Debug.LogWarning(warningInfo + Utility.GenerateExceptionDebugString(e)); modDirectories = new string[0]; } foreach (string modDirectory in modDirectories) { ModProfile profile = CacheClient.ReadJsonObjectFile <ModProfile>(modDirectory + "/profile.data"); if (profile != null) { yield return(profile); } } } }
public static List <ModTeamMember> LoadModTeam(int modId) { string filePath = CacheClient.GenerateModTeamFilePath(modId); var modTeam = CacheClient.ReadJsonObjectFile <List <ModTeamMember> >(filePath); return(modTeam); }
public static Modfile LoadModfile(int modId, int modfileId) { string modfileFilePath = GenerateModfileFilePath(modId, modfileId); var modfile = CacheClient.ReadJsonObjectFile <Modfile>(modfileFilePath); return(modfile); }
public static ModProfile LoadModProfile(int modId) { string profileFilePath = GenerateModProfileFilePath(modId); ModProfile profile = CacheClient.ReadJsonObjectFile <ModProfile>(profileFilePath); return(profile); }
public static List <int> LoadAuthenticatedUserSubscriptions() { AuthenticatedUser au = CacheClient.ReadJsonObjectFile <AuthenticatedUser>(userFilePath); if (au != null) { return(au.subscribedModIds); } return(null); }
public static string LoadAuthenticatedUserToken() { AuthenticatedUser au = CacheClient.ReadJsonObjectFile <AuthenticatedUser>(userFilePath); if (au != null) { return(au.oAuthToken); } return(null); }
public static UserProfile LoadAuthenticatedUserProfile() { AuthenticatedUser au = CacheClient.ReadJsonObjectFile <AuthenticatedUser>(userFilePath); if (au != null && au.userId > 0) { return(LoadUserProfile(au.userId)); } return(null); }
public static void SaveAuthenticatedUserMods(List <int> modIds) { AuthenticatedUser au = CacheClient.ReadJsonObjectFile <AuthenticatedUser>(userFilePath); if (au == null) { au = new AuthenticatedUser(); } au.modIds = modIds; CacheClient.WriteJsonObjectFile(userFilePath, au); }
public static void SaveAuthenticatedUserSubscriptions(List <int> subscribedModIds) { AuthenticatedUser au = CacheClient.ReadJsonObjectFile <AuthenticatedUser>(userFilePath); if (au == null) { au = new AuthenticatedUser(); } au.subscribedModIds = subscribedModIds; CacheClient.WriteJsonObjectFile(userFilePath, au); }
public static void SaveAuthenticatedUserToken(string oAuthToken) { AuthenticatedUser au = CacheClient.ReadJsonObjectFile <AuthenticatedUser>(userFilePath); if (au == null) { au = new AuthenticatedUser(); } au.oAuthToken = oAuthToken; CacheClient.WriteJsonObjectFile(userFilePath, au); }
public static void SaveAuthenticatedUserProfile(UserProfile userProfile) { CacheClient.SaveUserProfile(userProfile); AuthenticatedUser au = CacheClient.ReadJsonObjectFile <AuthenticatedUser>(userFilePath); if (au == null) { au = new AuthenticatedUser(); } au.userId = userProfile.id; CacheClient.WriteJsonObjectFile(userFilePath, au); }
public static Dictionary <LogoSize, string> LoadModLogoVersionInfo(int modId) { return(CacheClient.ReadJsonObjectFile <Dictionary <LogoSize, string> >(CacheClient.GenerateModLogoVersionInfoFilePath(modId))); }
public static GameProfile LoadGameProfile() { return(CacheClient.ReadJsonObjectFile <GameProfile>(gameProfileFilePath)); }