/// <summary> /// Update the current user cache by looking through the loaded cache /// </summary> /// <param name="CurrentUserId"></param> public void SetCurrentCache(string CurrentUserId) { CurrentUserCache = null; using (IEnumerator <OneDriveCache> Enumerator = Cache.GetEnumerator()) { bool FoundCurrentUser = false; while (!FoundCurrentUser && Enumerator.MoveNext()) { OneDriveCache UserCache = Enumerator.Current; if (UserCache.UserId.Equals(CurrentUserId)) { CurrentUserCache = UserCache; FoundCurrentUser = true; } } } if (CurrentUserCache is null) { // the current user has not been found in the cache, so now we need to create a user cache CreateEmptyUserCache(CurrentUserId); } }
/// <summary> /// Create a brand new user cache and add it to the cache list /// </summary> /// <param name="CurrentUserId"></param> public void CreateEmptyUserCache(string CurrentUserId) { CurrentUserCache = new OneDriveCache(CurrentUserId); Cache.Add(CurrentUserCache); }