daily update on 20240610 by nitload youmu
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Controlling.UsrActivity
|
||||
{
|
||||
|
||||
public struct KeyTrigger: ITrigger,IEquatable<KeyTrigger>
|
||||
{
|
||||
public KeyboardKey TargetKey;
|
||||
private KeyStatus _triggerStat;
|
||||
|
||||
int ITrigger.TargetKeyOrButtonID => (int)TargetKey;
|
||||
|
||||
KeyStatus ITrigger.TriggeredStatus => _triggerStat;
|
||||
|
||||
public KeyTrigger(KeyboardKey targetKey)
|
||||
{
|
||||
this.TargetKey = targetKey;
|
||||
}
|
||||
|
||||
public static bool operator ==(KeyTrigger left, KeyTrigger right)
|
||||
{
|
||||
return left._triggerStat == right._triggerStat && left.TargetKey == right.TargetKey;
|
||||
}
|
||||
|
||||
public static bool operator !=(KeyTrigger left, KeyTrigger right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (int)TargetKey + 17 * (int)_triggerStat;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Key {TargetKey} triggered when {_triggerStat}";
|
||||
}
|
||||
|
||||
bool IEquatable<KeyTrigger>.Equals(KeyTrigger other)
|
||||
{
|
||||
return other == this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user