|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
|
@ -8,12 +9,17 @@ namespace SkyHook
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
|
|
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
|
|
|
public struct SkyHookEvent
|
|
|
|
public readonly struct SkyHookEvent
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Epoch ticks to append in <see cref="GetTimeInTicks"/>.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
private static readonly long EpochTicks = new DateTime(1970, 1, 1).Ticks;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Precise time of the key's state update in seconds.
|
|
|
|
/// Precise time of the key's state update in seconds.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public readonly ulong TimeSec;
|
|
|
|
public readonly long TimeSec;
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Precise time of the key's state update but only contains nanoseconds.
|
|
|
|
/// Precise time of the key's state update but only contains nanoseconds.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -30,6 +36,13 @@ namespace SkyHook
|
|
|
|
/// The key number that was pressed or released.
|
|
|
|
/// The key number that was pressed or released.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public readonly ushort Key;
|
|
|
|
public readonly ushort Key;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Returns the sum of <see cref="TimeSec"/> and <see cref="TimeSubsecNano"/> in ticks.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns>The sum of <see cref="TimeSec"/> and <see cref="TimeSubsecNano"/> in ticks.</returns>
|
|
|
|
|
|
|
|
public long GetTimeInTicks()
|
|
|
|
|
|
|
|
=> (TimeSec * 10000000) + (TimeSubsecNano / 100) + EpochTicks;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|