Skip to content

Library Rangers Helpers

Gabriel edited this page Sep 26, 2023 · 1 revision

Helpers

Provides utilities for various functions.

Functions;

  • List<int> GetSubstringIndices(string in_str, string in_substr) - returns a list of indices where the input substring is found in a given string.
  • string PtrToStringUTF8(nint in_ptr) - returns a UTF-8 string from the input location.
  • string PtrToStringUTF8(nint in_ptr, int in_length) - returns a UTF-8 string with a fixed length from the input location.
  • nint StringToCoTaskMemUTF8(string in_str) - marshals the input UTF-8 string and returns a pointer to it.

Macros;

  • UNMANAGED_FUNCTION(in_returnType, in_functionName, ...) - creates an __stdcall delegate with an unmanaged function pointer based on the provided function signature.
  • UNMANAGED_FUNCTION_DELEGATE(in_returnType, in_functionName, ...) - creates an __stdcall delegate based on the provided function signature.
  • GET_UNMANAGED_FUNCTION_PTR(in_functionName) - returns the function pointer created by UNMANAGED_FUNCTION().
  • CREATE_UNMANAGED_FUNCTION_PTR(in_functionName, in_location) - creates a function pointer for a delegate created by UNMANAGED_FUNCTION_DELEGATE().
  • FUNCTION_PTR(in_returnType, in_functionName, in_location, ...) - creates a function pointer to native code at the specified location.
  • GET_FUNCTION_PTR(in_functionName) - returns the function pointer delegate created by FUNCTION_PTR().
  • UNMANAGED_FIXED_ARRAY(in_type, in_name, in_size) - creates a fixed array with support for managed types.
  • TO_STRING_PTR(in_str) - returns a pointer to the input ANSI string.
  • TO_WSTRING_PTR(in_str) - returns a pointer to the input Unicode string.
  • TO_U8STRING_PTR(in_str) - returns a pointer to the input UTF-8 string.
  • FROM_STRING_PTR(in_ptr) - returns an ANSI string from the input location.
  • FROM_WSTRING_PTR(in_ptr) - returns a Unicode string from the input location.
  • FROM_U8STRING_PTR(in_ptr) - returns a UTF-8 string from the input location.

Types;

  • struct UnmanagedString - a struct representation of a pointer to a string.
    • Members;
      • long pValue - a pointer to a string.
      • string Value - the string retrieved from pValue.
    • Functions;
      • bool Equals(object in_obj) - returns whether the input object is identical to this struct or string.
      • int GetHashCode() - returns the hash code of the string.
      • string ToString() - returns the string.
Clone this wiki locally