Beispiel #1
0
        public static void GetProfile(string username, out GsProfile profile)
        {
            Contract.Requires(username != null);

            int i = username.IndexOf('@', StringComparison.Ordinal);

            if
            (
                i >= 0 &&
                _emails.TryGetValue(username[(i + 1)..], out int id1) &&
Beispiel #2
0
        public static void AddProfile(string email, string nick, string password, out GsProfile profile)
        {
            int id = Interlocked.Increment(ref _nextProfileId);

            profile = new GsProfile()
            {
                Id = id,

                Email    = email,
                Nick     = nick,
                Password = password
            };

            if (!_profiles.TryAdd(id, profile) || !_emails.TryAdd(email, id) || !_nicks.TryAdd(nick, id))
            {
                throw new NotSupportedException();
            }
        }