mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 05:43:40 +01:00
throw if set value is non-zero
This commit is contained in:
parent
eb6680e097
commit
9a5ef1acab
1 changed files with 8 additions and 1 deletions
|
|
@ -52,6 +52,7 @@ namespace Dalamud.Game.ClientState.Keys
|
|||
/// <param name="vkCode">The virtual key to change.</param>
|
||||
/// <returns>Whether the specified key is currently pressed.</returns>
|
||||
/// <exception cref="ArgumentException">If the vkCode is not valid. Refer to <see cref="IsVirtualKeyValid(int)"/> or <see cref="GetValidVirtualKeys"/>.</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">If the set value is non-zero.</exception>
|
||||
public unsafe bool this[int vkCode]
|
||||
{
|
||||
get => this.GetRawValue(vkCode) != 0;
|
||||
|
|
@ -84,8 +85,14 @@ namespace Dalamud.Game.ClientState.Keys
|
|||
/// <param name="vkCode">The virtual key to change.</param>
|
||||
/// <param name="value">The raw value to set in the index array.</param>
|
||||
/// <exception cref="ArgumentException">If the vkCode is not valid. Refer to <see cref="IsVirtualKeyValid(int)"/> or <see cref="GetValidVirtualKeys"/>.</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">If the set value is non-zero.</exception>
|
||||
public void SetRawValue(int vkCode, int value)
|
||||
=> this.GetRefValue(vkCode) = value;
|
||||
{
|
||||
if (value != 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(value), "Dalamud does not support pressing keys, only preventing them via zero or False. If you have a valid use-case for this, please contact the dev team.");
|
||||
|
||||
this.GetRefValue(vkCode) = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="SetRawValue(int, int)"/>
|
||||
public void SetRawValue(VirtualKey vkCode, int value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue