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

View File

@ -2,8 +2,15 @@ using System;
namespace SkyHook
{
public class SkyHookException : Exception
{
public SkyHookException(string message) : base(message) { }
}
/// <summary>
/// An <see cref="Exception"/> that specifically occurred in SkyHook.
/// </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.Threading;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Events;
namespace SkyHook
{
/// <summary>
/// Manages SkyHook activity.
/// A "<see cref="GameObject.DontDestroyOnLoad"/>ed" instance will be created automatically upon use.
/// </summary>
public class SkyHookManager : MonoBehaviour
{
private static SkyHookManager _instance;
/// <summary>
/// Whether this process is focused.
/// </summary>
public static bool IsFocused;
/// <summary>
@ -20,6 +26,9 @@ namespace SkyHook
// ReSharper disable once FieldCanBeMadeReadOnly.Global
public bool requireFocus = true;
/// <summary>
/// Whether the hook is active now.
/// </summary>
public bool isHookActive;
/// <summary>

View File

@ -2,16 +2,31 @@ using System.Runtime.InteropServices;
namespace SkyHook
{
internal static class SkyHookNative
{
public delegate void Callback(SkyHookEvent ev);
/// <summary>
/// Native method calls for SkyHook.
/// </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)]
public static extern string StartHook(Callback callback);
/// <summary>
/// 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)]
public static extern string StopHook();
}
/// <summary>
/// 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();
}
}