fix: add missing docs for public/internal members

develop
CrackThrough 2022-11-06 22:16:34 +09:00
parent 58581a7c53
commit 06407c97a1
4 changed files with 53 additions and 16 deletions

View File

@ -3,16 +3,19 @@ using System.Runtime.InteropServices;
namespace SkyHook namespace SkyHook
{ {
/// <summary>
/// Recorded key updates from SkyHook.
/// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public struct SkyHookEvent public struct SkyHookEvent
{ {
/// <summary> /// <summary>
/// When the key was pressed. /// When the key's state was updated.
/// </summary> /// </summary>
public readonly ulong Time; public readonly ulong Time;
/// <summary> /// <summary>
/// The key is pressed or released. /// Whether the key is pressed or released.
/// </summary> /// </summary>
public readonly EventType Type; public readonly EventType Type;
/// <summary> /// <summary>
@ -25,6 +28,9 @@ namespace SkyHook
public readonly ushort Key; public readonly ushort Key;
} }
/// <summary>
/// The type of <see cref="SkyHookEvent"/>'s event.
/// </summary>
public enum EventType public enum EventType
{ {
KeyPressed, KeyPressed,

View File

@ -2,8 +2,15 @@ using System;
namespace SkyHook namespace SkyHook
{ {
public class SkyHookException : Exception /// <summary>
{ /// An <see cref="Exception"/> that specifically occurred in SkyHook.
public SkyHookException(string message) : base(message) { } /// </summary>
} public class SkyHookException : Exception
{
/// <summary>
/// Initializes an instance of <see cref="SkyHookException"/>.
/// </summary>
/// <param name="message">A message to pass along with exception.</param>
public SkyHookException(string message) : base(message) { }
}
} }

View File

@ -1,15 +1,21 @@
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
namespace SkyHook namespace SkyHook
{ {
/// <summary>
/// Manages SkyHook activity.
/// A "<see cref="GameObject.DontDestroyOnLoad"/>ed" instance will be created automatically upon use.
/// </summary>
public class SkyHookManager : MonoBehaviour public class SkyHookManager : MonoBehaviour
{ {
private static SkyHookManager _instance; private static SkyHookManager _instance;
/// <summary>
/// Whether this process is focused.
/// </summary>
public static bool IsFocused; public static bool IsFocused;
/// <summary> /// <summary>
@ -20,6 +26,9 @@ namespace SkyHook
// ReSharper disable once FieldCanBeMadeReadOnly.Global // ReSharper disable once FieldCanBeMadeReadOnly.Global
public bool requireFocus = true; public bool requireFocus = true;
/// <summary>
/// Whether the hook is active now.
/// </summary>
public bool isHookActive; public bool isHookActive;
/// <summary> /// <summary>

View File

@ -2,16 +2,31 @@ using System.Runtime.InteropServices;
namespace SkyHook namespace SkyHook
{ {
internal static class SkyHookNative /// <summary>
{ /// Native method calls for SkyHook.
public delegate void Callback(SkyHookEvent ev); /// </summary>
internal static class SkyHookNative
{
/// <summary>
/// The native callback handled by <see cref="SkyHookManager"/>.
/// </summary>
public delegate void Callback(SkyHookEvent ev);
private const string Lib = "skyhook"; private const string Lib = "skyhook";
[DllImport(Lib, EntryPoint = "start_hook", CallingConvention = CallingConvention.Cdecl)] /// <summary>
public static extern string StartHook(Callback callback); /// The native version of <see cref="SkyHookManager.StartHook"/> method handled by <see cref="SkyHookManager"/>.
/// </summary>
/// <param name="callback">A native callback.</param>
/// <returns><c>null</c> if no error, or an error message.</returns>
[DllImport(Lib, EntryPoint = "start_hook", CallingConvention = CallingConvention.Cdecl)]
public static extern string StartHook(Callback callback);
[DllImport(Lib, EntryPoint = "stop_hook", CallingConvention = CallingConvention.Cdecl)] /// <summary>
public static extern string StopHook(); /// The native version of <see cref="SkyHookManager.StopHook"/> method handled by <see cref="SkyHookManager"/>.
} /// </summary>
/// <returns><c>null</c> if no error, or an error message.</returns>
[DllImport(Lib, EntryPoint = "stop_hook", CallingConvention = CallingConvention.Cdecl)]
public static extern string StopHook();
}
} }