예제 #1
0
        /// <summary>
        ///     Connects to the PlayerIO service using the provided credentials.
        /// </summary>
        /// <param name="gameId">The game id.</param>
        /// <param name="email">Email address.</param>
        /// <param name="password">Password or token.</param>
        /// <returns>A client object.</returns>
        /// <exception cref="System.InvalidOperationException">Invalid authentication type.</exception>
        internal Client LogOn(string gameId, string email, string password)
        {
            // Clean the email (or token), and gameId from whitespace
            email  = Regex.Replace(email, @"\s+", string.Empty);
            gameId = Regex.Replace(gameId, @"\s+", string.Empty);

            if (AuthenticationType == AuthenticationType.Unknown)
            {
                AuthenticationType = GetAuthType(email, password);
            }

            switch (AuthenticationType)
            {
            case AuthenticationType.Facebook:     return(Facebook.Authenticate(gameId, password));

            case AuthenticationType.Kongregate:   return(Kongregate.Authenticate(gameId, email, password));

            case AuthenticationType.ArmorGames:   return(ArmorGames.Authenticate(gameId, email, password));

            case AuthenticationType.Mousebreaker: return(MouseBreaker.Authenticate(gameId, email, password));

            case AuthenticationType.UserName:     return(UserName.Authenticate(gameId, email, password));

            default:                              return(Simple.Authenticate(gameId, email, password));
            }
        }