public UserSpecified(string screenName) { _originalScreenName = screenName; _userId = AccountsStore.Accounts .Where(u => u.AuthenticateInfo.UnreliableScreenName == screenName) .Select(u => u.UserId) .FirstOrDefault(); if (_userId == 0) { _userId = UserStore.GetId(screenName); } else { _adata = AccountRelationDataStore.Get(_userId); } }
public UserSpecified(long id) { _userId = id; _adata = AccountRelationDataStore.Get(_userId); }
/// <summary> /// Store data for an account. /// </summary> /// <param name="data">storing data</param> public static void Set(AccountRelationData data) { lock (StoreLocker) { Store[data.AccountId] = data; } }
/// <summary> /// Get account data fot the account id.<para /> /// If not exited, create it new. /// </summary> /// <param name="id">account id</param> /// <returns>account data</returns> public static AccountRelationData Get(long id) { lock (StoreLocker) { AccountRelationData data; if (Store.TryGetValue(id, out data)) { return data; } data = new AccountRelationData(id); data.AccountDataUpdated += OnAccountDataUpdated; Store.Add(id, data); return data; } }