Esempio n. 1
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. 2
0
 // ---------[ USERS ]---------
 public static string GenerateUserProfileFilePath(int userId)
 {
     return(CacheClient.GetCacheDirectory()
            + "users/"
            + userId + ".data");
 }