Ejemplo n.º 1
0
        /// <summary>
        /// Gets a user profile key for the specified type of statistic.
        /// </summary>
        /// <param name="profileType">The type of statistic (ladder, non-ladder).</param>
        /// <param name="recordType">The type of record (wins, losses).</param>
        /// <param name="client">The client for which to request.</param>
        /// <returns>A non-writeable UserProfileKey.</returns>
        /// <exception cref="InvalidEnumArgumentException">Thrown if <paramref name="profileType"/> or <paramref name="recordType"/>
        /// are values that are not defined by their enumerations.</exception>
        /// <exception cref="ArgumentOutOfRangeException">If the product specified by <paramref name="client"/> was invalid, or if the
        /// type of profile or record was not appropriate for the client (for example, IronMan Ladder is only valid for Warcraft II:
        /// Battle.net Edition).</exception>
        public static UserProfileKey GetRecordKey(ProfileRecordKeyType profileType, RecordKeyType recordType, Product client)
        {
            if (profileType == ProfileRecordKeyType.IronManLadder && client != Product.Warcraft2BNE)
            {
                throw new InvalidEnumArgumentException("profileType", (int)profileType, typeof(ProfileRecordKeyType));
            }

            switch (profileType)
            {
            case ProfileRecordKeyType.Normal:
                return(GetRecordKey(recordType, client));

            case ProfileRecordKeyType.Ladder:
                return(GetLadderRecordKey(recordType, client));

            case ProfileRecordKeyType.IronManLadder:
                return(GetIronManLadderRecordKey(recordType, client));

            default:
                throw new InvalidEnumArgumentException("profileType", (int)profileType, typeof(ProfileRecordKeyType));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets a user profile key for the specified type of statistic.
        /// </summary>
        /// <param name="profileType">The type of statistic (ladder, non-ladder).</param>
        /// <param name="recordType">The type of record (wins, losses).</param>
        /// <param name="client">The client for which to request.</param>
        /// <returns>A non-writeable UserProfileKey.</returns>
        /// <exception cref="InvalidEnumArgumentException">Thrown if <paramref name="profileType"/> or <paramref name="recordType"/>
        /// are values that are not defined by their enumerations.</exception>
        /// <exception cref="ArgumentOutOfRangeException">If the product specified by <paramref name="client"/> was invalid, or if the 
        /// type of profile or record was not appropriate for the client (for example, IronMan Ladder is only valid for Warcraft II: 
        /// Battle.net Edition).</exception>
        public static UserProfileKey GetRecordKey(ProfileRecordKeyType profileType, RecordKeyType recordType, Product client)
        {
            if (profileType == ProfileRecordKeyType.IronManLadder && client != Product.Warcraft2BNE)
                throw new InvalidEnumArgumentException("profileType", (int)profileType, typeof(ProfileRecordKeyType));

            switch (profileType)
            {
                case ProfileRecordKeyType.Normal:
                    return GetRecordKey(recordType, client);
                case ProfileRecordKeyType.Ladder:
                    return GetLadderRecordKey(recordType, client);
                case ProfileRecordKeyType.IronManLadder:
                    return GetIronManLadderRecordKey(recordType, client);
                default:
                    throw new InvalidEnumArgumentException("profileType", (int)profileType, typeof(ProfileRecordKeyType));
            }
        }