/// <summary> /// Signs the given user into Xbox Live. /// </summary> /// <param name="systemIpAddress">The system IP address of the console.</param> /// <param name="user">The user to sign in.</param> /// <param name="password">The password of the user for signing in. If a password has been stored on the console, <c>null</c> can be passed in.</param> /// <param name="storePassword">If <c>true</c>, saves the given password on the console for later use.</param> /// <returns>An XboxUserDefinition of the signed-in user.</returns> protected override XboxUserDefinition SignInUserImpl(string systemIpAddress, XboxUserDefinition user, string password, bool storePassword) { if (user == null) { throw new ArgumentNullException("user", "user cannot be null"); } try { return(this.XboxXdk.SignInUser(systemIpAddress, user, password, storePassword)); } catch (COMException ex) { switch (unchecked ((uint)ex.ErrorCode)) { case 0x80048823: throw new XboxSignInException(string.Format(CultureInfo.InvariantCulture, "The given user's email address {0} is not valid.", user.EmailAddress), ex, systemIpAddress); case 0x8004882E: throw new XboxSignInException("The password for the given user is not stored on the console. You must supply a password as part of the sign in operation.", ex, systemIpAddress); case 0x80048821: throw new XboxSignInException("The password for the given user is invalid.", ex, systemIpAddress); case 0x8015DC16: throw new XboxSignInException("The given user is signed in on another console.", ex, systemIpAddress); default: throw; } } }
public void TestConstructorsCorrectlySetProperties() { const uint ExpectedId = TestUserId; const string ExpectedEmail = TestEmailAddress; const string ExpectedGamerTag = TestGamertag; const string ExpectedXuidValue = TestXuidString; bool expectedAutoSignInValue = true; bool expectedIsSignedInValue = false; this.TestXboxUserProperties( ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue, () => new XboxUser(this.xboxConsole, ExpectedId, ExpectedEmail, ExpectedGamerTag, false)); this.TestXboxUserProperties( ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue, () => new XboxUser(this.xboxConsole, ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue)); this.TestXboxUserProperties( ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue, expectedAutoSignInValue, ExpectedXuidValue, () => new XboxUser(this.xboxConsole, ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue, expectedAutoSignInValue, ExpectedXuidValue)); expectedIsSignedInValue = true; expectedAutoSignInValue = false; this.TestXboxUserProperties( ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue, () => new XboxUser(this.xboxConsole, ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue)); this.TestXboxUserProperties( ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue, expectedAutoSignInValue, ExpectedXuidValue, () => new XboxUser(this.xboxConsole, ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue, expectedAutoSignInValue, ExpectedXuidValue)); XboxUserDefinition definition = new XboxUserDefinition(ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue); this.TestXboxUserProperties( ExpectedId, ExpectedEmail, ExpectedGamerTag, expectedIsSignedInValue, () => new XboxUser(this.xboxConsole, definition)); }
/// <summary> /// Removes the specified user from the console. /// </summary> /// <param name="systemIpAddress">The system IP address of the console.</param> /// <param name="user">The user to be removed.</param> /// <remarks>A signed-in user is signed out before being removed from the console.</remarks> protected override void DeleteUserImpl(string systemIpAddress, XboxUserDefinition user) { this.XboxXdk.DeleteUser(systemIpAddress, user); }
/// <summary> /// Signs out the given user. /// </summary> /// <param name="systemIpAddress">The system IP address of the console.</param> /// <param name="user">The user to sign-out.</param> /// <returns>An XboxUserDefinition of the signed-out user.</returns> protected override XboxUserDefinition SignOutUserImpl(string systemIpAddress, XboxUserDefinition user) { return(this.XboxXdk.SignOutUser(systemIpAddress, user)); }