Skip to content

Commit

Permalink
Fix missing docs in preloader
Browse files Browse the repository at this point in the history
  • Loading branch information
ghorsington committed Aug 6, 2020
1 parent 78484b7 commit 9ff80ca
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
4 changes: 0 additions & 4 deletions BepInEx.Preloader/Entrypoint.cs
Expand Up @@ -57,10 +57,6 @@ internal static class Entrypoint
/// <summary>
/// The main entrypoint of BepInEx, called from Doorstop.
/// </summary>
/// <param name="args">
/// The arguments passed in from Doorstop. First argument is the path of the currently executing
/// process.
/// </param>
public static void Main()
{
// We set it to the current directory first as a fallback, but try to use the same location as the .exe file.
Expand Down
8 changes: 8 additions & 0 deletions BepInEx.Preloader/Logger/PreloaderConsoleListener.cs
Expand Up @@ -4,10 +4,17 @@

namespace BepInEx.Preloader
{
/// <summary>
/// Log listener that listens to logs during preloading time and buffers messages for output in Unity logs later.
/// </summary>
public class PreloaderConsoleListener : ILogListener
{
/// <summary>
///
/// </summary>
public static List<LogEventArgs> LogEvents { get; } = new List<LogEventArgs>();

/// <inheritdoc />
public void LogEvent(object sender, LogEventArgs eventArgs)
{
if ((eventArgs.Level & ConfigConsoleDisplayedLevel.Value) == 0)
Expand All @@ -21,6 +28,7 @@ public void LogEvent(object sender, LogEventArgs eventArgs)
LogLevel.Fatal | LogLevel.Error | LogLevel.Message | LogLevel.Info | LogLevel.Warning,
"Which log levels to show in the console output.");

/// <inheritdoc />
public void Dispose() { }
}
}
7 changes: 5 additions & 2 deletions BepInEx.Preloader/Patching/AssemblyPatcher.cs
Expand Up @@ -27,6 +27,9 @@ public static class AssemblyPatcher
{
private const BindingFlags ALL = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase;

/// <summary>
/// List of all patcher plugins to be applied
/// </summary>
public static List<PatcherPlugin> PatcherPlugins { get; } = new List<PatcherPlugin>();

private static readonly string DumpedAssembliesPath = Path.Combine(Paths.BepInExRootPath, "DumpedAssemblies");
Expand Down Expand Up @@ -76,7 +79,6 @@ private static PatcherPlugin ToPatcherPlugin(TypeDefinition type)
/// Adds all patchers from all managed assemblies specified in a directory.
/// </summary>
/// <param name="directory">Directory to search patcher DLLs from.</param>
/// <param name="patcherLocator">A function that locates assembly patchers in a given managed assembly.</param>
public static void AddPatchersFromDirectory(string directory)
{
if (!Directory.Exists(directory))
Expand Down Expand Up @@ -195,7 +197,7 @@ private static string GetAssemblyName(string fullName)
{
return new AssemblyName(fullName).Name;
}
catch (Exception e)
catch (Exception)
{
return fullName;
}
Expand Down Expand Up @@ -344,6 +346,7 @@ public static void PatchAndLoad(string directory)
/// Loads an individual assembly definition into the CLR.
/// </summary>
/// <param name="assembly">The assembly to load.</param>
/// <param name="filename">File name of the assembly being loaded.</param>
public static void Load(AssemblyDefinition assembly, string filename)
{
if (ConfigLoadDumpedAssemblies.Value)
Expand Down
2 changes: 2 additions & 0 deletions BepInEx.Preloader/Patching/PatcherPlugin.cs
Expand Up @@ -35,11 +35,13 @@ public class PatcherPlugin : ICacheable
/// </summary>
public string TypeName { get; set; } = string.Empty;

/// <inheritdoc />
public void Save(BinaryWriter bw)
{
bw.Write(TypeName);
}

/// <inheritdoc />
public void Load(BinaryReader br)
{
TypeName = br.ReadString();
Expand Down
2 changes: 1 addition & 1 deletion BepInEx.Preloader/RuntimeFixes/UnityPatches.cs
Expand Up @@ -14,7 +14,7 @@ internal static class UnityPatches

public static void Apply()
{
HarmonyInstance = HarmonyWrapper.PatchAll(typeof(UnityPatches), HarmonyInstance);
HarmonyInstance = HarmonyLib.Harmony.CreateAndPatchAll(typeof(UnityPatches));

try
{
Expand Down

0 comments on commit 9ff80ca

Please sign in to comment.