mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-10 02:55:41 +00:00
refactor: offer cls-compliant attribute ctors
This commit is contained in:
parent
7084fc3f4a
commit
9171872ec4
@ -1,15 +1,29 @@
|
|||||||
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
||||||
|
|
||||||
|
#pragma warning disable CA1019 // Define accessors for attribute arguments
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies that this command can only be run by bots.
|
/// Specifies that this command can only be run by bots.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class RequireAvatarNameAttribute : PreExecutionCheckAttribute
|
public sealed class RequireAvatarNameAttribute : PreExecutionCheckAttribute
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="RequireAvatarNameAttribute" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="names">An enumerable collection of allowed user names.</param>
|
||||||
|
/// <exception cref="ArgumentNullException"><paramref name="names" /> is <see langword="null" />.</exception>
|
||||||
|
public RequireAvatarNameAttribute(IEnumerable<string> names)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(names);
|
||||||
|
Names = names.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="RequireAvatarNameAttribute" /> class.
|
/// Initializes a new instance of the <see cref="RequireAvatarNameAttribute" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="names">An array of allowed user names.</param>
|
/// <param name="names">An array of allowed user names.</param>
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="names" /> is <see langword="null" />.</exception>
|
/// <exception cref="ArgumentNullException"><paramref name="names" /> is <see langword="null" />.</exception>
|
||||||
|
[CLSCompliant(false)]
|
||||||
public RequireAvatarNameAttribute(params string[] names)
|
public RequireAvatarNameAttribute(params string[] names)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(names);
|
ArgumentNullException.ThrowIfNull(names);
|
||||||
|
@ -1,15 +1,29 @@
|
|||||||
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
||||||
|
|
||||||
|
#pragma warning disable CA1019 // Define accessors for attribute arguments
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies that this command can only be run by bots.
|
/// Specifies that this command can only be run by bots.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class RequireUserIdAttribute : PreExecutionCheckAttribute
|
public sealed class RequireUserIdAttribute : PreExecutionCheckAttribute
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="RequireUserIdAttribute" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userIds">An enumerable collection of allowed user IDs.</param>
|
||||||
|
/// <exception cref="ArgumentNullException"><paramref name="userIds" /> is <see langword="null" />.</exception>
|
||||||
|
public RequireUserIdAttribute(IEnumerable<int> userIds)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(userIds);
|
||||||
|
UserIds = userIds.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="RequireUserIdAttribute" /> class.
|
/// Initializes a new instance of the <see cref="RequireUserIdAttribute" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userIds">An array of allowed user IDs.</param>
|
/// <param name="userIds">An array of allowed user IDs.</param>
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="userIds" /> is <see langword="null" />.</exception>
|
/// <exception cref="ArgumentNullException"><paramref name="userIds" /> is <see langword="null" />.</exception>
|
||||||
|
[CLSCompliant(false)]
|
||||||
public RequireUserIdAttribute(params int[] userIds)
|
public RequireUserIdAttribute(params int[] userIds)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(userIds);
|
ArgumentNullException.ThrowIfNull(userIds);
|
||||||
|
@ -1,15 +1,29 @@
|
|||||||
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
||||||
|
|
||||||
|
#pragma warning disable CA1019 // Define accessors for attribute arguments
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies that this command can only be run by bots.
|
/// Specifies that this command can only be run by bots.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class RequireUserNameAttribute : PreExecutionCheckAttribute
|
public sealed class RequireUserNameAttribute : PreExecutionCheckAttribute
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="RequireUserNameAttribute" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="names">An enumerable collection of allowed user names.</param>
|
||||||
|
/// <exception cref="ArgumentNullException"><paramref name="names" /> is <see langword="null" />.</exception>
|
||||||
|
public RequireUserNameAttribute(IEnumerable<string> names)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(names);
|
||||||
|
Names = names.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="RequireUserNameAttribute" /> class.
|
/// Initializes a new instance of the <see cref="RequireUserNameAttribute" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="names">An array of allowed user names.</param>
|
/// <param name="names">An array of allowed user names.</param>
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="names" /> is <see langword="null" />.</exception>
|
/// <exception cref="ArgumentNullException"><paramref name="names" /> is <see langword="null" />.</exception>
|
||||||
|
[CLSCompliant(false)]
|
||||||
public RequireUserNameAttribute(params string[] names)
|
public RequireUserNameAttribute(params string[] names)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(names);
|
ArgumentNullException.ThrowIfNull(names);
|
||||||
|
Loading…
Reference in New Issue
Block a user