Resonite Modding Wiki

website·Indexed 31 days ago

https://modding.resonite.net

Documentation for modding Resonite, featuring a comprehensive API reference for BepInEx integration. Includes details on the AssemblyPatcher, ConfigFile management, BasePlugin, and various BepInEx.Preloader and BepInEx.Core classes for creating and using mods.

Tokens
22.2K
Snippets
177
Records
237
Agent score
55%

What's inside Resonite Modding

  1. Overview of BepInEx.Preloader.Core.Patching classes

    The BepInEx.Preloader.Core.Patching namespace provides the core infrastructure for patching assemblies during the preloading phase. It includes worker classes for managing assembly loading, base classes for implementing patchers, and attributes for defining patch targets and plugin metadata.
  2. Overview of BepInEx.Logging components

    The BepInEx.Logging namespace provides a pub-sub logging system where log sources emit messages and log listeners route those messages to specific outputs (such as the console or disk).
  3. Overview of BepInEx.Bootstrap namespace

    The BepInEx.Bootstrap namespace provides utilities for loading assemblies and managing type caching. Key components include TypeLoader for loading specific types from assemblies and CachedAssembly<T> for handling cached assembly data.
  4. Use ConfigEntryBase to manage a single configuration setting

    The ConfigEntryBase class serves as a container for a single setting within a ConfigFile. It is an abstract class that links a specific setting to a configuration file and manages its definition, description, and value.
    public abstract class ConfigEntryBase
  5. Route .NET Trace logs to BepInEx using TraceLogSource

    The TraceLogSource class is a TraceListener that reroutes all logs from the inbuilt .NET System.Diagnostics.Trace API to the BepInEx logging system. This is useful for capturing low-level system traces and directing them through BepInEx's logging infrastructure.
    public class TraceLogSource : TraceListener, IDisposable
  6. Use BepInExWarningLogInterpolatedStringHandler for optimized logging

    The BepInExWarningLogInterpolatedStringHandler is an interpolated string handler for the BepInEx Logger. It is designed to improve performance by allowing the system to conditionally skip the construction of logging messages when the specific log level is disabled, reducing overhead in performance-critical areas.

    This class is not intended to be instantiated manually by developers. Instead, it is utilized automatically by the compiler when using string interpolation with BepInEx.Logging.ManualLogSource.Log.

    // Do not instantiate BepInExWarningLogInterpolatedStringHandler manually.
    // Use ManualLogSource.Log with string interpolation instead:
    logger.Log(LogLevel.Warn, $"This is an interpolated warning message with value: {value}");
  7. Use AcceptableValueBase to enforce configuration value constraints

    The AcceptableValueBase class is the abstract base for all classes that represent and enforce acceptable values for configuration settings. It provides a framework for validating values and clamping them to a supported range or set.
    public abstract class AcceptableValueBase
  8. Use PreloaderConsoleListener to buffer logs during preloading

    The PreloaderConsoleListener class implements ILogListener and IDisposable. It is used to listen to logs during the preloading phase and buffers these messages for later output in Unity logs. It provides a static list of all received log events via the LogEvents property.
    public class PreloaderConsoleListener : ILogListener, IDisposable
  9. BaseChainloader<TPlugin> Class Overview

    The BaseChainloader<TPlugin> is an abstract class designed to handle the discovery and loading of plugins. It manages a collection of loaded plugins and tracks dependency errors encountered during the loading process.
    public abstract class BaseChainloader<TPlugin>
  10. Define a configuration setting with ConfigDefinition

    The ConfigDefinition class represents the unique identity of a setting within a ConfigFile. It consists of a Section (the group the setting belongs to) and a Key (the name of the setting). Both the section and key are case-sensitive. While the same ConfigDefinition can be used across multiple config files, it will refer to different settings in each file.
    // Create a definition for a setting in the "MyMod" section with the key "EnableFeature"
    var mySettingDef = new ConfigDefinition("MyMod", "EnableFeature");
  11. Use the LogEventArgs class to handle log event data

    The LogEventArgs class (inheriting from EventArgs) is used to encapsulate information about a log message. It provides access to the actual logged data, the severity level of the log, and the source that emitted the event.
    public class LogEventArgs : EventArgs