Esempio n. 1
0
        public static UserProfile LoadUserProfile(int userId)
        {
            string filePath    = CacheClient.GenerateUserProfileFilePath(userId);
            var    userProfile = CacheClient.ReadJsonObjectFile <UserProfile>(filePath);

            return(userProfile);
        }
Esempio n. 2
0
        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);
                    }
                }
            }
        }
Esempio n. 3
0
        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);
                    }
                }
            }
        }
Esempio n. 4
0
        public static List <ModTeamMember> LoadModTeam(int modId)
        {
            string filePath = CacheClient.GenerateModTeamFilePath(modId);
            var    modTeam  = CacheClient.ReadJsonObjectFile <List <ModTeamMember> >(filePath);

            return(modTeam);
        }
Esempio n. 5
0
        public static Modfile LoadModfile(int modId, int modfileId)
        {
            string modfileFilePath = GenerateModfileFilePath(modId, modfileId);
            var    modfile         = CacheClient.ReadJsonObjectFile <Modfile>(modfileFilePath);

            return(modfile);
        }
Esempio n. 6
0
        public static ModProfile LoadModProfile(int modId)
        {
            string     profileFilePath = GenerateModProfileFilePath(modId);
            ModProfile profile         = CacheClient.ReadJsonObjectFile <ModProfile>(profileFilePath);

            return(profile);
        }
Esempio n. 7
0
        public static List <int> LoadAuthenticatedUserSubscriptions()
        {
            AuthenticatedUser au = CacheClient.ReadJsonObjectFile <AuthenticatedUser>(userFilePath);

            if (au != null)
            {
                return(au.subscribedModIds);
            }
            return(null);
        }
Esempio n. 8
0
        public static string LoadAuthenticatedUserToken()
        {
            AuthenticatedUser au = CacheClient.ReadJsonObjectFile <AuthenticatedUser>(userFilePath);

            if (au != null)
            {
                return(au.oAuthToken);
            }
            return(null);
        }
Esempio n. 9
0
        public static UserProfile LoadAuthenticatedUserProfile()
        {
            AuthenticatedUser au = CacheClient.ReadJsonObjectFile <AuthenticatedUser>(userFilePath);

            if (au != null &&
                au.userId > 0)
            {
                return(LoadUserProfile(au.userId));
            }
            return(null);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        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);
        }
Esempio n. 14
0
 public static Dictionary <LogoSize, string> LoadModLogoVersionInfo(int modId)
 {
     return(CacheClient.ReadJsonObjectFile <Dictionary <LogoSize, string> >(CacheClient.GenerateModLogoVersionInfoFilePath(modId)));
 }
Esempio n. 15
0
 public static GameProfile LoadGameProfile()
 {
     return(CacheClient.ReadJsonObjectFile <GameProfile>(gameProfileFilePath));
 }