Browse Source

Added lots of XML documentation

Bepis 6 years ago
parent
commit
67acf9c576

+ 2 - 0
BepInEx/BepInEx.csproj

@@ -21,6 +21,8 @@
     <DefineConstants>TRACE;CECIL_10</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <DocumentationFile>
+    </DocumentationFile>
   </PropertyGroup>
   <PropertyGroup>
     <StartupObject />

+ 34 - 6
BepInEx/Bootstrap/AssemblyPatcher.cs

@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -7,16 +8,33 @@ using Mono.Cecil;
 
 namespace BepInEx.Bootstrap
 {
+	/// <summary>
+	/// Delegate used in patching assemblies.
+	/// </summary>
+	/// <param name="assembly">The assembly that is being patched.</param>
     public delegate void AssemblyPatcherDelegate(ref AssemblyDefinition assembly);
 
+	/// <summary>
+	/// Worker class which is used for loading and patching entire folders of assemblies, or alternatively patching and loading assemblies one at a time.
+	/// </summary>
     public static class AssemblyPatcher
     {
+		/// <summary>
+		/// Configuration value of whether assembly dumping is enabled or not.
+		/// </summary>
         private static bool DumpingEnabled => bool.TryParse(Config.GetEntry("preloader-dumpassemblies", "false"), out bool result) ? result : false;
 
-        public static void PatchAll(string directory, Dictionary<AssemblyPatcherDelegate, IEnumerable<string>> patcherMethodDictionary)
+		/// <summary>
+		/// Patches and loads an entire directory of assemblies.
+		/// </summary>
+		/// <param name="directory">The directory to load assemblies from.</param>
+		/// <param name="patcherMethodDictionary">The dictionary of patchers and their targeted assembly filenames which they are patching.</param>
+        public static void PatchAll(string directory, IDictionary<AssemblyPatcherDelegate, IEnumerable<string>> patcherMethodDictionary, IEnumerable<Action> Initializers = null, IEnumerable<Action> Finalizers = null)
         {
 			//run all initializers
-			Preloader.Initializers.ForEach(x => x.Invoke());
+			if (Initializers != null)
+				foreach (Action init in Initializers)
+					init.Invoke();
 
             //load all the requested assemblies
             List<AssemblyDefinition> assemblies = new List<AssemblyDefinition>();
@@ -102,17 +120,27 @@ namespace BepInEx.Bootstrap
 				sortedAssemblies[i].Dispose();
 #endif
             }
-
 			
-	        //run all initializers
-	        Preloader.Initializers.ForEach(x => x.Invoke());
+	        //run all finalizers
+	        if (Finalizers != null)
+		        foreach (Action finalizer in Finalizers)
+			        finalizer.Invoke();
         }
 
+		/// <summary>
+		/// Patches an individual assembly, without loading it.
+		/// </summary>
+		/// <param name="assembly">The assembly definition to apply the patch to.</param>
+		/// <param name="patcherMethod">The patcher to use to patch the assembly definition.</param>
         public static void Patch(ref AssemblyDefinition assembly, AssemblyPatcherDelegate patcherMethod)
         {
 	        patcherMethod.Invoke(ref assembly);
         }
 
+		/// <summary>
+		/// Loads an individual assembly defintion into the CLR.
+		/// </summary>
+		/// <param name="assembly">The assembly to load.</param>
 	    public static void Load(AssemblyDefinition assembly)
 	    {
 		    using (MemoryStream assemblyStream = new MemoryStream())

+ 2 - 2
BepInEx/Bootstrap/Chainloader.cs

@@ -13,7 +13,7 @@ using UnityLogWriter = BepInEx.Logging.UnityLogWriter;
 namespace BepInEx.Bootstrap
 {
 	/// <summary>
-	/// The manager and loader for all plugins, and the entry point for BepInEx.
+	/// The manager and loader for all plugins, and the entry point for BepInEx plugin system.
 	/// </summary>
 	public class Chainloader
 	{
@@ -31,7 +31,7 @@ namespace BepInEx.Bootstrap
 		private static bool _loaded = false;
 
 		/// <summary>
-		/// The entry point for BepInEx, called on the very first LoadScene() from UnityEngine.
+		/// The entry point for the BepInEx plugin system, called on the very first LoadScene() from UnityEngine.
 		/// </summary>
 		public static void Initialize()
 		{

+ 88 - 13
BepInEx/Bootstrap/Preloader.cs

@@ -14,41 +14,91 @@ using MethodAttributes = Mono.Cecil.MethodAttributes;
 
 namespace BepInEx.Bootstrap
 {
+	/// <summary>
+	/// The main entrypoint of BepInEx, and initializes all patchers and the chainloader.
+	/// </summary>
     public static class Preloader
     {
         #region Path Properties
 
+		/// <summary>
+		/// The path of the currently executing program BepInEx is encapsulated in.
+		/// </summary>
         public static string ExecutablePath { get; private set; }
 
-        public static string CurrentExecutingAssemblyPath => Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "").Replace('/', '\\');
-
-        public static string CurrentExecutingAssemblyDirectoryPath => Path.GetDirectoryName(CurrentExecutingAssemblyPath);
-
-        public static string GameName => Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().ProcessName);
-
-        public static string GameRootPath => Path.GetDirectoryName(ExecutablePath);
-
-        public static string ManagedPath => Utility.CombinePaths(GameRootPath, $"{GameName}_Data", "Managed");
-
-        public static string PluginPath => Utility.CombinePaths(GameRootPath, "BepInEx");
-
-        public static string PatcherPluginPath => Utility.CombinePaths(GameRootPath, "BepInEx", "patchers");
+		/// <summary>
+		/// The path to the core BepInEx DLL.
+		/// </summary>
+        public static string CurrentExecutingAssemblyPath { get; } = typeof(Preloader).Assembly.CodeBase.Replace("file:///", "").Replace('/', '\\');
+
+		/// <summary>
+		/// The directory that the core BepInEx DLLs reside in.
+		/// </summary>
+	    public static string CurrentExecutingAssemblyDirectoryPath { get; } = Path.GetDirectoryName(CurrentExecutingAssemblyPath);
+
+		/// <summary>
+		/// The name of the currently executing process.
+		/// </summary>
+        public static string ProcessName { get; } = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().ProcessName);
+
+		/// <summary>
+		/// The directory that the currently executing process resides in.
+		/// </summary>
+        public static string GameRootPath { get; } = Path.GetDirectoryName(ExecutablePath);
+
+		/// <summary>
+		/// The path to the Managed folder of the currently running Unity game.
+		/// </summary>
+        public static string ManagedPath { get; } = Utility.CombinePaths(GameRootPath, $"{ProcessName}_Data", "Managed");
+
+		/// <summary>
+		/// The path to the main BepInEx folder.
+		/// </summary>
+        public static string PluginPath { get; } = Utility.CombinePaths(GameRootPath, "BepInEx");
+
+		/// <summary>
+		/// The path to the patcher plugin folder which resides in the BepInEx folder.
+		/// </summary>
+        public static string PatcherPluginPath { get; } = Utility.CombinePaths(GameRootPath, "BepInEx", "patchers");
 
         #endregion
 
+		/// <summary>
+		/// The log writer that is specific to the preloader.
+		/// </summary>
         public static PreloaderLogWriter PreloaderLog { get; private set; }
 
+		/// <summary>
+		/// The dictionary of currently loaded patchers. The key is the patcher delegate that will be used to patch, and the value is a list of filenames of assemblies that the patcher is targeting.
+		/// </summary>
         public static Dictionary<AssemblyPatcherDelegate, IEnumerable<string>> PatcherDictionary { get; } = new Dictionary<AssemblyPatcherDelegate, IEnumerable<string>>();
 		
+		/// <summary>
+		/// The list of initializers that were loaded from the patcher contract.
+		/// </summary>
 	    public static List<Action> Initializers { get; } = new List<Action>();
+	    /// <summary>
+	    /// The list of finalizers that were loaded from the patcher contract.
+	    /// </summary>
 	    public static List<Action> Finalizers { get; } = new List<Action>();
 
 
+		/// <summary>
+		/// Adds the patcher to the patcher dictionary.
+		/// </summary>
+		/// <param name="dllNames">The list of DLL filenames to be patched.</param>
+		/// <param name="patcher">The method that will perform the patching.</param>
         public static void AddPatcher(IEnumerable<string> dllNames, AssemblyPatcherDelegate patcher)
         {
 	        PatcherDictionary[patcher] = dllNames;
         }
 
+		/// <summary>
+		/// Safely retrieves a boolean value from the config. Returns false if not able to retrieve safely.
+		/// </summary>
+		/// <param name="key">The key to retrieve from the config.</param>
+		/// <param name="defaultValue">The default value to both return and set if the key does not exist in the config.</param>
+		/// <returns>The value of the key if found in the config, or the default value specified if not found, or false if it was unable to safely retrieve the value from the config.</returns>
         private static bool SafeGetConfigBool(string key, string defaultValue)
         {
             try
@@ -63,6 +113,9 @@ namespace BepInEx.Bootstrap
             }
         }
 
+		/// <summary>
+		/// Allocates a console window for use by BepInEx safely.
+		/// </summary>
         internal static void AllocateConsole()
         {
             bool console = SafeGetConfigBool("console", "false");
@@ -90,6 +143,10 @@ namespace BepInEx.Bootstrap
             }
         }
 
+		/// <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(string[] args)
         {
             try
@@ -152,6 +209,11 @@ namespace BepInEx.Bootstrap
             }
         }
 
+		/// <summary>
+		/// Scans the assembly for classes that use the patcher contract, and returns a dictionary of the patch methods.
+		/// </summary>
+		/// <param name="assembly">The assembly to scan.</param>
+		/// <returns>A dictionary of delegates which will be used to patch the targeted assemblies.</returns>
         internal static Dictionary<AssemblyPatcherDelegate, IEnumerable<string>> GetPatcherMethods(Assembly assembly)
         {
             var patcherMethods = new Dictionary<AssemblyPatcherDelegate, IEnumerable<string>>();
@@ -248,6 +310,10 @@ namespace BepInEx.Bootstrap
             return patcherMethods;
         }
 
+		/// <summary>
+		/// Inserts BepInEx's own chainloader entrypoint into UnityEngine.
+		/// </summary>
+		/// <param name="assembly">The assembly that will be attempted to be patched.</param>
         internal static void PatchEntrypoint(ref AssemblyDefinition assembly)
         {
             if (assembly.Name.Name == "UnityEngine")
@@ -283,6 +349,15 @@ namespace BepInEx.Bootstrap
             }
         }
 
+		/// <summary>
+		/// A handler for <see cref="AppDomain"/>.AssemblyResolve to perform some special handling.
+		/// <para>
+		/// It attempts to check currently loaded assemblies (ignoring the version), and then checks the BepInEx/core path, BepInEx/patchers path and the BepInEx folder, all in that order.
+		/// </para>
+		/// </summary>
+		/// <param name="sender"></param>
+		/// <param name="args"></param>
+		/// <returns></returns>
         internal static Assembly LocalResolve(object sender, ResolveEventArgs args)
         {
             AssemblyName assemblyName = new AssemblyName(args.Name);

+ 3 - 0
BepInEx/Bootstrap/TypeLoader.cs

@@ -6,6 +6,9 @@ using BepInEx.Logging;
 
 namespace BepInEx.Bootstrap
 {
+	/// <summary>
+	/// Provides methods for loading specified types from an assembly.
+	/// </summary>
     public static class TypeLoader
     {
         /// <summary>

+ 19 - 10
BepInEx/Config.cs

@@ -24,6 +24,9 @@ namespace BepInEx
                 handler.Invoke();
         }
 
+		/// <summary>
+		/// An event that is fired every time the config is reloaded.
+		/// </summary>
         public static event Action ConfigReloaded;
 
         /// <summary>
@@ -42,14 +45,15 @@ namespace BepInEx
                 SaveConfig();
             }
         }
-        
-        /// <summary>
-        /// Returns the value of the key if found, otherwise returns the default value.
-        /// </summary>
-        /// <param name="key">The key to search for.</param>
-        /// <param name="defaultValue">The default value to return if the key is not found.</param>
-        /// <returns>The value of the key.</returns>
-        public static string GetEntry(string key, string defaultValue = "", string section = "")
+
+	    /// <summary>
+	    /// Returns the value of the key if found, otherwise returns the default value.
+	    /// </summary>
+	    /// <param name="key">The key to search for.</param>
+	    /// <param name="defaultValue">The default value to return if the key is not found.</param>
+	    /// <param name="section">The section of the config to search the key for.</param>
+	    /// <returns>The value of the key.</returns>
+	    public static string GetEntry(string key, string defaultValue = "", string section = "")
         {
             key = Sanitize(key);
             if (section.IsNullOrWhiteSpace())
@@ -196,9 +200,14 @@ namespace BepInEx
             return true;
         }
 
-        public static string Sanitize(string key)
+		/// <summary>
+		/// Replaces any potentially breaking input with underscores.
+		/// </summary>
+		/// <param name="text">The text to sanitize.</param>
+		/// <returns>Sanitized text.</returns>
+        public static string Sanitize(string text)
         {
-            return sanitizeKeyRegex.Replace(key, "_");
+            return sanitizeKeyRegex.Replace(text, "_");
         }
 
         #region Extensions

+ 36 - 2
BepInEx/Contract/Attributes.cs

@@ -100,13 +100,26 @@ namespace BepInEx
 
     #region MetadataHelper
 
+	/// <summary>
+	/// Helper class to use for retrieving metadata about a plugin, defined as attributes.
+	/// </summary>
     public static class MetadataHelper
     {
+		/// <summary>
+		/// Retrieves the BepInPlugin metadata from a plugin instance.
+		/// </summary>
+		/// <param name="plugin">The plugin instance.</param>
+		/// <returns>The BepInPlugin metadata of the plugin instance.</returns>
         public static BepInPlugin GetMetadata(object plugin)
         {
             return GetMetadata(plugin.GetType());
         }
-
+		
+	    /// <summary>
+	    /// Retrieves the BepInPlugin metadata from a plugin type.
+	    /// </summary>
+	    /// <param name="plugin">The plugin type.</param>
+	    /// <returns>The BepInPlugin metadata of the plugin type.</returns>
         public static BepInPlugin GetMetadata(Type pluginType)
         {
             object[] attributes = pluginType.GetCustomAttributes(typeof(BepInPlugin), false);
@@ -117,16 +130,34 @@ namespace BepInEx
             return (BepInPlugin)attributes[0];
         }
 
+		/// <summary>
+		/// Gets the specified attributes of an instance, if they exist.
+		/// </summary>
+		/// <typeparam name="T">The attribute type to retrieve.</typeparam>
+		/// <param name="plugin">The plugin instance.</param>
+		/// <returns>The attributes of the instance, if existing.</returns>
         public static IEnumerable<T> GetAttributes<T>(object plugin) where T : Attribute
         {
             return GetAttributes<T>(plugin.GetType());
         }
-
+		
+	    /// <summary>
+	    /// Gets the specified attributes of a type, if they exist.
+	    /// </summary>
+	    /// <typeparam name="T">The attribute type to retrieve.</typeparam>
+	    /// <param name="plugin">The plugin type.</param>
+	    /// <returns>The attributes of the type, if existing.</returns>
         public static IEnumerable<T> GetAttributes<T>(Type pluginType) where T : Attribute
         {
             return pluginType.GetCustomAttributes(typeof(T), true).Cast<T>();
         }
 
+		/// <summary>
+		/// Retrieves the dependencies of the specified plugin type.
+		/// </summary>
+		/// <param name="Plugin">The plugin type.</param>
+		/// <param name="AllPlugins">All currently loaded plugin types.</param>
+		/// <returns>A list of all plugin types that the specified plugin type depends upon.</returns>
         public static IEnumerable<Type> GetDependencies(Type Plugin, IEnumerable<Type> AllPlugins)
         {
             object[] attributes = Plugin.GetCustomAttributes(typeof(BepInDependency), true);
@@ -153,6 +184,9 @@ namespace BepInEx
         }
     }
 
+	/// <summary>
+	/// An exception which is thrown when a plugin's dependencies cannot be found.
+	/// </summary>
     public class MissingDependencyException : Exception
     {
         public MissingDependencyException(string message) : base(message)

+ 2 - 3
BepInEx/Contract/BaseUnityPlugin.cs

@@ -1,10 +1,9 @@
-using System;
-using UnityEngine;
+using UnityEngine;
 
 namespace BepInEx
 {
     /// <summary>
-    /// The base plugin type, that is loaded into the game.
+    /// The base plugin type that is used by the BepInEx plugin loader.
     /// </summary>
     public abstract class BaseUnityPlugin : MonoBehaviour
     {

+ 19 - 2
BepInEx/Logging/BaseLogger.cs

@@ -3,8 +3,14 @@ using System.Text;
 
 namespace BepInEx.Logging
 {
+	/// <summary>
+	/// The base implementation of a logging class.
+	/// </summary>
     public abstract class BaseLogger : TextWriter
     {
+		/// <summary>
+		/// The encoding that the underlying text writer should use. Defaults to UTF-8 BOM.
+		/// </summary>
         public override Encoding Encoding { get; } = new UTF8Encoding(true);
 
 
@@ -20,11 +26,18 @@ namespace BepInEx.Logging
         /// </summary>
         public event EntryLoggedEventHandler EntryLogged;
 
-        
-        public LogLevel DisplayedLevels = LogLevel.All;
+        /// <summary>
+		/// A filter which is used to specify which log levels are not ignored by the logger.
+		/// </summary>
+        public LogLevel DisplayedLevels { get; set; } = LogLevel.All;
 
         private object logLockObj = new object();
 
+		/// <summary>
+		/// Logs an entry to the Logger instance.
+		/// </summary>
+		/// <param name="level">The level of the entry.</param>
+		/// <param name="entry">The textual value of the entry.</param>
         public virtual void Log(LogLevel level, object entry)
         {
             if ((DisplayedLevels & level) != LogLevel.None)
@@ -37,6 +50,10 @@ namespace BepInEx.Logging
             }
         }
 
+		/// <summary>
+		/// Logs an entry to the Logger instance, with a <see cref="LogLevel"/> of Message.
+		/// </summary>
+		/// <param name="entry">The text value of this log entry.</param>
         public virtual void Log(object entry)
         {
             Log(LogLevel.Message, entry);

+ 44 - 1
BepInEx/Logging/LogLevel.cs

@@ -1,23 +1,61 @@
 using System;
-using System.Linq;
 
 namespace BepInEx.Logging
 {
+	/// <summary>
+	/// The level, or severity of a log entry.
+	/// </summary>
     [Flags]
     public enum LogLevel
     {
+		/// <summary>
+		/// No level selected.
+		/// </summary>
         None = 0,
+
+		/// <summary>
+		/// A fatal error has occurred, which cannot be recovered from.
+		/// </summary>
         Fatal = 1,
+
+		/// <summary>
+		/// An error has occured, but can be recovered from.
+		/// </summary>
         Error = 2,
+
+		/// <summary>
+		/// A warning has been produced, but does not necessarily mean that something wrong has happened.
+		/// </summary>
         Warning = 4,
+
+		/// <summary>
+		/// An important message that should be displayed to the user.
+		/// </summary>
         Message = 8,
+
+		/// <summary>
+		/// A message of low importance.
+		/// </summary>
         Info = 16,
+
+		/// <summary>
+		/// A message that would likely only interest a developer.
+		/// </summary>
         Debug = 32,
+
+		/// <summary>
+		/// All log levels.
+		/// </summary>
         All = Fatal | Error | Warning | Message | Info | Debug
     }
 
     public static class LogLevelExtensions
     {
+		/// <summary>
+		/// Gets the highest log level when there could potentially be multiple levels provided.
+		/// </summary>
+		/// <param name="levels">The log level(s).</param>
+		/// <returns>The highest log level supplied.</returns>
         public static LogLevel GetHighestLevel(this LogLevel levels)
         {
             var enums = Enum.GetValues(typeof(LogLevel));
@@ -32,6 +70,11 @@ namespace BepInEx.Logging
             return LogLevel.None;
         }
 
+		/// <summary>
+		/// Returns a translation of a log level to it's associated console colour.
+		/// </summary>
+		/// <param name="level">The log level(s).</param>
+		/// <returns>A console color associated with the highest log level supplied.</returns>
         public static ConsoleColor GetConsoleColor(this LogLevel level)
         {
             level = GetHighestLevel(level);

+ 15 - 0
BepInEx/Logging/Logger.cs

@@ -2,8 +2,14 @@
 
 namespace BepInEx
 {
+	/// <summary>
+	/// A static <see cref="BaseLogger"/> instance.
+	/// </summary>
     public static class Logger
     {
+		/// <summary>
+		/// The current instance of a <see cref="BaseLogger"/> that is being used.
+		/// </summary>
         public static BaseLogger CurrentLogger { get; set; }
 
         /// <summary>
@@ -11,6 +17,11 @@ namespace BepInEx
         /// </summary>
         public static event BaseLogger.EntryLoggedEventHandler EntryLogged;
 
+		/// <summary>
+		/// Logs an entry to the current logger instance.
+		/// </summary>
+		/// <param name="level">The level of the entry.</param>
+		/// <param name="entry">The textual value of the entry.</param>
         public static void Log(LogLevel level, object entry)
         {
             EntryLogged?.Invoke(level, entry);
@@ -18,6 +29,10 @@ namespace BepInEx
             CurrentLogger?.Log(level, entry);
         }
 
+		/// <summary>
+		/// Sets the instance being used by the static <see cref="Logger"/> class.
+		/// </summary>
+		/// <param name="logger">The instance to use in the static class.</param>
         public static void SetLogger(BaseLogger logger)
         {
             CurrentLogger?.Dispose();

+ 23 - 4
BepInEx/Logging/LoggerTraceListener.cs

@@ -6,9 +6,16 @@ using Harmony;
 
 namespace BepInEx.Logging
 {
+	/// <summary>
+	/// A trace listener that writes to an underlying <see cref="BaseLogger"/> instance.
+	/// </summary>
+	/// <inheritdoc cref="TraceListener"/>
     public class LoggerTraceListener : TraceListener
     {
-        public BaseLogger Logger;
+		/// <summary>
+		/// The logger instance that is being written to.
+		/// </summary>
+        public BaseLogger Logger { get; }
 
         static LoggerTraceListener()
         {
@@ -18,17 +25,26 @@ namespace BepInEx.Logging
             }
             catch { } //ignore everything, if it's thrown an exception, we're using an assembly that has already fixed this
         }
-
+		
+		/// <param name="logger">The logger instance to write to.</param>
         public LoggerTraceListener(BaseLogger logger)
         {
             Logger = logger;
         }
-
+		
+		/// <summary>
+		/// Writes a message to the underlying <see cref="BaseLogger"/> instance.
+		/// </summary>
+		/// <param name="message">The message to write.</param>
         public override void Write(string message)
         {
             Logger.Write(message);
         }
-
+		
+	    /// <summary>
+	    /// Writes a message and a newline to the underlying <see cref="BaseLogger"/> instance.
+	    /// </summary>
+	    /// <param name="message">The message to write.</param>
         public override void WriteLine(string message)
         {
             Logger.WriteLine(message);
@@ -64,6 +80,9 @@ namespace BepInEx.Logging
             Logger.Log(level, $"{source} : {message}");
         }
 
+		/// <summary>
+		/// This exists because the Mono implementation of <see cref="Trace"/> is/was broken, and would call Write directly instead of calling TraceEvent. This class fixes that with a <see cref="Harmony"/> hook.
+		/// </summary>
         private static class TraceFixer
         {
             private static Type TraceImplType;

+ 29 - 2
BepInEx/Logging/PreloaderLogWriter.cs

@@ -2,20 +2,35 @@
 using System.Diagnostics;
 using System.IO;
 using System.Text;
+using BepInEx.Bootstrap;
 using BepInEx.ConsoleUtil;
 
 namespace BepInEx.Logging
 {
+	/// <summary>
+	/// A log writer specific to the <see cref="Preloader"/>.
+	/// </summary>
+	/// <inheritdoc cref="BaseLogger"/>
     public class PreloaderLogWriter : BaseLogger
     {
+		/// <summary>
+		/// The <see cref="System.Text.StringBuilder"/> which contains all logged entries, so it may be passed onto another log writer.
+		/// </summary>
         public StringBuilder StringBuilder { get; protected set; } = new StringBuilder();
 
+		/// <summary>
+		/// Whether or not the log writer is redirecting console output, so it can be logged.
+		/// </summary>
         public bool IsRedirectingConsole { get; protected set; }
 
         protected TextWriter stdout;
         protected LoggerTraceListener traceListener;
 
         private bool _enabled = false;
+
+		/// <summary>
+		/// Whether or not the log writer is writing and/or redirecting.
+		/// </summary>
         public bool Enabled {
             get => _enabled;
             set
@@ -26,7 +41,8 @@ namespace BepInEx.Logging
                     Disable();
             }
         }
-
+		
+		/// <param name="redirectConsole">Whether or not to redirect the console standard output.</param>
         public PreloaderLogWriter(bool redirectConsole)
         {
             IsRedirectingConsole = redirectConsole;
@@ -35,6 +51,9 @@ namespace BepInEx.Logging
             traceListener = new LoggerTraceListener(this);
         }
 
+		/// <summary>
+		/// Enables the log writer.
+		/// </summary>
         public void Enable()
         {
             if (_enabled)
@@ -50,6 +69,9 @@ namespace BepInEx.Logging
             _enabled = true;
         }
 
+		/// <summary>
+		/// Disables the log writer.
+		/// </summary>
         public void Disable()
         {
             if (!_enabled)
@@ -61,7 +83,12 @@ namespace BepInEx.Logging
 
             _enabled = false;
         }
-
+		
+	    /// <summary>
+	    /// Logs an entry to the Logger instance.
+	    /// </summary>
+	    /// <param name="level">The level of the entry.</param>
+	    /// <param name="entry">The textual value of the entry.</param>
         public override void Log(LogLevel level, object entry)
         {
             Kon.ForegroundColor = level.GetConsoleColor();

+ 12 - 0
BepInEx/Logging/UnityLogWriter.cs

@@ -4,8 +4,15 @@ using BepInEx.ConsoleUtil;
 
 namespace BepInEx.Logging
 {
+	/// <summary>
+	/// Logs entries using Unity specific outputs.
+	/// </summary>
     public class UnityLogWriter : BaseLogger
     {
+		/// <summary>
+		/// Writes a string specifically to the game output log.
+		/// </summary>
+		/// <param name="value">The value to write.</param>
         public void WriteToLog(string value)
         {
             UnityEngine.UnityLogWriter.WriteStringToUnityLog(value);
@@ -17,6 +24,11 @@ namespace BepInEx.Logging
             WriteToLog(value);
         }
 
+	    /// <summary>
+	    /// Logs an entry to the Logger instance.
+	    /// </summary>
+	    /// <param name="level">The level of the entry.</param>
+	    /// <param name="entry">The textual value of the entry.</param>
         public override void Log(LogLevel level, object entry)
         {
             Kon.ForegroundColor = level.GetConsoleColor();