From 06407c97a181f7bfd976b8890d859bb12f4450ad Mon Sep 17 00:00:00 2001 From: CrackThrough Date: Sun, 6 Nov 2022 22:16:34 +0900 Subject: [PATCH] fix: add missing docs for public/internal members --- Runtime/Event.cs | 10 ++++++++-- Runtime/SkyHookException.cs | 15 +++++++++++---- Runtime/SkyHookManager.cs | 11 ++++++++++- Runtime/SkyHookNative.cs | 33 ++++++++++++++++++++++++--------- 4 files changed, 53 insertions(+), 16 deletions(-) diff --git a/Runtime/Event.cs b/Runtime/Event.cs index 3b6900c..1b02741 100644 --- a/Runtime/Event.cs +++ b/Runtime/Event.cs @@ -3,16 +3,19 @@ using System.Runtime.InteropServices; namespace SkyHook { + /// + /// Recorded key updates from SkyHook. + /// [StructLayout(LayoutKind.Sequential)] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public struct SkyHookEvent { /// - /// When the key was pressed. + /// When the key's state was updated. /// public readonly ulong Time; /// - /// The key is pressed or released. + /// Whether the key is pressed or released. /// public readonly EventType Type; /// @@ -25,6 +28,9 @@ namespace SkyHook public readonly ushort Key; } + /// + /// The type of 's event. + /// public enum EventType { KeyPressed, diff --git a/Runtime/SkyHookException.cs b/Runtime/SkyHookException.cs index ba95428..bd1a685 100644 --- a/Runtime/SkyHookException.cs +++ b/Runtime/SkyHookException.cs @@ -2,8 +2,15 @@ using System; namespace SkyHook { - public class SkyHookException : Exception - { - public SkyHookException(string message) : base(message) { } - } + /// + /// An that specifically occurred in SkyHook. + /// + public class SkyHookException : Exception + { + /// + /// Initializes an instance of . + /// + /// A message to pass along with exception. + public SkyHookException(string message) : base(message) { } + } } \ No newline at end of file diff --git a/Runtime/SkyHookManager.cs b/Runtime/SkyHookManager.cs index 732462e..9b0f1b0 100644 --- a/Runtime/SkyHookManager.cs +++ b/Runtime/SkyHookManager.cs @@ -1,15 +1,21 @@ using System; using System.Threading; -using System.Threading.Tasks; using UnityEngine; using UnityEngine.Events; namespace SkyHook { + /// + /// Manages SkyHook activity. + /// A "ed" instance will be created automatically upon use. + /// public class SkyHookManager : MonoBehaviour { private static SkyHookManager _instance; + /// + /// Whether this process is focused. + /// public static bool IsFocused; /// @@ -20,6 +26,9 @@ namespace SkyHook // ReSharper disable once FieldCanBeMadeReadOnly.Global public bool requireFocus = true; + /// + /// Whether the hook is active now. + /// public bool isHookActive; /// diff --git a/Runtime/SkyHookNative.cs b/Runtime/SkyHookNative.cs index 347571b..0937e33 100644 --- a/Runtime/SkyHookNative.cs +++ b/Runtime/SkyHookNative.cs @@ -2,16 +2,31 @@ using System.Runtime.InteropServices; namespace SkyHook { - internal static class SkyHookNative - { - public delegate void Callback(SkyHookEvent ev); + /// + /// Native method calls for SkyHook. + /// + internal static class SkyHookNative + { + /// + /// The native callback handled by . + /// + public delegate void Callback(SkyHookEvent ev); - private const string Lib = "skyhook"; + private const string Lib = "skyhook"; - [DllImport(Lib, EntryPoint = "start_hook", CallingConvention = CallingConvention.Cdecl)] - public static extern string StartHook(Callback callback); + /// + /// The native version of method handled by . + /// + /// A native callback. + /// null if no error, or an error message. + [DllImport(Lib, EntryPoint = "start_hook", CallingConvention = CallingConvention.Cdecl)] + public static extern string StartHook(Callback callback); - [DllImport(Lib, EntryPoint = "stop_hook", CallingConvention = CallingConvention.Cdecl)] - public static extern string StopHook(); - } + /// + /// The native version of method handled by . + /// + /// null if no error, or an error message. + [DllImport(Lib, EntryPoint = "stop_hook", CallingConvention = CallingConvention.Cdecl)] + public static extern string StopHook(); + } } \ No newline at end of file