diff --git a/IPA.Loader/IPA.Loader.csproj b/IPA.Loader/IPA.Loader.csproj
index c15ab9df..a36de28c 100644
--- a/IPA.Loader/IPA.Loader.csproj
+++ b/IPA.Loader/IPA.Loader.csproj
@@ -22,6 +22,7 @@
prompt
4
true
+ bin\Debug\IPA.Loader.xml
pdbonly
diff --git a/IPA.Loader/Loader/Composite/CompositeBSPlugin.cs b/IPA.Loader/Loader/Composite/CompositeBSPlugin.cs
index 98169fad..62b499d8 100644
--- a/IPA.Loader/Loader/Composite/CompositeBSPlugin.cs
+++ b/IPA.Loader/Loader/Composite/CompositeBSPlugin.cs
@@ -9,7 +9,7 @@ using Logger = IPA.Logging.Logger;
namespace IPA.Loader.Composite
{
- public class CompositeBSPlugin : IBeatSaberPlugin
+ internal class CompositeBSPlugin : IBeatSaberPlugin
{
IEnumerable plugins;
diff --git a/IPA.Loader/Loader/Composite/CompositeIPAPlugin.cs b/IPA.Loader/Loader/Composite/CompositeIPAPlugin.cs
index c70714b6..0bd25d3d 100644
--- a/IPA.Loader/Loader/Composite/CompositeIPAPlugin.cs
+++ b/IPA.Loader/Loader/Composite/CompositeIPAPlugin.cs
@@ -11,7 +11,7 @@ using Logger = IPA.Logging.Logger;
namespace IPA.Loader.Composite
{
#pragma warning disable CS0618 // Type or member is obsolete
- public class CompositeIPAPlugin : IPlugin
+ internal class CompositeIPAPlugin : IPlugin
{
IEnumerable plugins;
diff --git a/IPA.Loader/Loader/PluginComponent.cs b/IPA.Loader/Loader/PluginComponent.cs
index 07e1e054..34417bed 100644
--- a/IPA.Loader/Loader/PluginComponent.cs
+++ b/IPA.Loader/Loader/PluginComponent.cs
@@ -9,13 +9,13 @@ using IPA.Logging;
namespace IPA.Loader
{
- public class PluginComponent : MonoBehaviour
+ internal class PluginComponent : MonoBehaviour
{
private CompositeBSPlugin bsPlugins;
private CompositeIPAPlugin ipaPlugins;
private bool quitting = false;
- public static PluginComponent Create()
+ internal static PluginComponent Create()
{
Application.logMessageReceived += delegate (string condition, string stackTrace, LogType type)
{
@@ -87,7 +87,7 @@ namespace IPA.Loader
ipaPlugins.OnLevelWasLoaded(level);
}
- public void OnLevelWasInitialized(int level)
+ void OnLevelWasInitialized(int level)
{
ipaPlugins.OnLevelWasInitialized(level);
}
diff --git a/IPA.Loader/Loader/PluginManager.cs b/IPA.Loader/Loader/PluginManager.cs
index 72e477e1..a63bb5da 100644
--- a/IPA.Loader/Loader/PluginManager.cs
+++ b/IPA.Loader/Loader/PluginManager.cs
@@ -5,6 +5,7 @@ using IPA.Updating;
using IPA.Utilities;
using Mono.Cecil;
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
@@ -17,17 +18,23 @@ using System.Threading.Tasks;
namespace IPA.Loader
{
+ ///
+ /// The manager class for all plugins.
+ ///
public static class PluginManager
{
#pragma warning disable CS0618 // Type or member is obsolete (IPlugin)
-
- public class BSPluginMeta
+
+ internal class BSPluginMeta
{
public IBeatSaberPlugin Plugin { get; internal set; }
public string Filename { get; internal set; }
public ModsaberModInfo ModsaberInfo { get; internal set; }
}
+ ///
+ /// An of new Beat Saber plugins
+ ///
public static IEnumerable BSPlugins
{
get
@@ -52,6 +59,9 @@ namespace IPA.Loader
}
}
+ ///
+ /// An of old IPA plugins
+ ///
public static IEnumerable Plugins
{
get
@@ -288,7 +298,7 @@ namespace IPA.Loader
return new Tuple, IEnumerable>(bsPlugins, ipaPlugins);
}
- public class AppInfo
+ internal class AppInfo
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = false)]
private static extern int GetModuleFileName(HandleRef hModule, StringBuilder buffer, int length);
diff --git a/IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs b/IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs
index bc05ded5..ab6fa4e3 100644
--- a/IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs
+++ b/IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs
@@ -8,18 +8,33 @@ using IPA.Logging;
namespace IPA.Logging.Printers
{
+ ///
+ /// Prints a pretty message to the console.
+ ///
public class ColoredConsolePrinter : LogPrinter
{
Logger.LogLevel filter = Logger.LogLevel.All;
- public override Logger.LogLevel Filter { get => filter; set => filter = value; }
- ConsoleColor color = Console.ForegroundColor;
- public ConsoleColor Color { get => color; set => color = value; }
+ ///
+ /// A filter for this specific printer.
+ ///
+ public override Logger.LogLevel Filter { get => filter; set => filter = value; }
+ ///
+ /// The color to print messages as.
+ ///
+ public ConsoleColor Color { get; set; } = Console.ForegroundColor;
+ ///
+ /// Prints an entry to the associated file.
+ ///
+ /// the of the message
+ /// the the message was recorded at
+ /// the name of the log that sent the message
+ /// the message to print
public override void Print(Logger.Level level, DateTime time, string logName, string message)
{
if (((byte)level & (byte)StandardLogger.PrintFilter) == 0) return;
- Console.ForegroundColor = color;
+ Console.ForegroundColor = Color;
foreach (var line in message.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
Console.WriteLine(string.Format(Logger.LogFormat, line, logName, time, level.ToString().ToUpper()));
Console.ResetColor();
diff --git a/IPA.Loader/Logging/Printers/GZFilePrinter.cs b/IPA.Loader/Logging/Printers/GZFilePrinter.cs
index bc0f9d86..cfe46747 100644
--- a/IPA.Loader/Logging/Printers/GZFilePrinter.cs
+++ b/IPA.Loader/Logging/Printers/GZFilePrinter.cs
@@ -10,6 +10,9 @@ using System.Threading.Tasks;
namespace IPA.Logging.Printers
{
+ ///
+ /// A abstract class that provides the utilities to write to a GZip file.
+ ///
public abstract class GZFilePrinter : LogPrinter
{
[DllImport("Kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
@@ -20,13 +23,20 @@ namespace IPA.Logging.Printers
);
[DllImport("Kernel32.dll")]
- static extern Int32 GetLastError();
+ static extern int GetLastError();
private FileInfo fileInfo;
+ ///
+ /// The that writes to the GZip file.
+ ///
protected StreamWriter fileWriter;
private GZipStream zstream;
private FileStream fstream;
+ ///
+ /// Gets the for the file to write to without the .gz extension.
+ ///
+ ///
protected abstract FileInfo GetFileInfo();
private void InitLog()
@@ -64,6 +74,9 @@ namespace IPA.Logging.Printers
}
}
+ ///
+ /// Called at the start of any print session.
+ ///
public override sealed void StartPrint()
{
InitLog();
@@ -76,6 +89,9 @@ namespace IPA.Logging.Printers
fileWriter = new StreamWriter(zstream, new UTF8Encoding(false));
}
+ ///
+ /// Called at the end of any print session.
+ ///
public override sealed void EndPrint()
{
fileWriter.Flush();
diff --git a/IPA.Loader/Logging/Printers/GlobalLogFilePrinter.cs b/IPA.Loader/Logging/Printers/GlobalLogFilePrinter.cs
index a3b14187..f8e67e7d 100644
--- a/IPA.Loader/Logging/Printers/GlobalLogFilePrinter.cs
+++ b/IPA.Loader/Logging/Printers/GlobalLogFilePrinter.cs
@@ -8,16 +8,33 @@ using IPA.Logging;
namespace IPA.Logging.Printers
{
- class GlobalLogFilePrinter : GZFilePrinter
+ ///
+ /// A printer for all messages to a unified log location.
+ ///
+ public class GlobalLogFilePrinter : GZFilePrinter
{
+ ///
+ /// Provides a filter for this specific printer.
+ ///
public override Logger.LogLevel Filter { get; set; } = Logger.LogLevel.All;
- public override void Print(IPA.Logging.Logger.Level level, DateTime time, string logName, string message)
+ ///
+ /// Prints an entry to the associated file.
+ ///
+ /// the of the message
+ /// the the message was recorded at
+ /// the name of the log that sent the message
+ /// the message to print
+ public override void Print(Logger.Level level, DateTime time, string logName, string message)
{
foreach (var line in message.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
fileWriter.WriteLine(string.Format(Logger.LogFormat, line, logName, time, level.ToString().ToUpper()));
}
+ ///
+ /// Gets the for the target file.
+ ///
+ ///
protected override FileInfo GetFileInfo()
{
var logsDir = new DirectoryInfo("Logs");
diff --git a/IPA.Loader/Logging/Printers/PluginLogFilePrinter.cs b/IPA.Loader/Logging/Printers/PluginLogFilePrinter.cs
index c34a5481..63525913 100644
--- a/IPA.Loader/Logging/Printers/PluginLogFilePrinter.cs
+++ b/IPA.Loader/Logging/Printers/PluginLogFilePrinter.cs
@@ -8,12 +8,22 @@ using System.Threading.Tasks;
namespace IPA.Logging.Printers
{
- class PluginLogFilePrinter : GZFilePrinter
+ ///
+ /// Prints log messages to the file specified by the name.
+ ///
+ public class PluginLogFilePrinter : GZFilePrinter
{
+ ///
+ /// Provides a filter for this specific printer.
+ ///
public override Logger.LogLevel Filter { get; set; } = Logger.LogLevel.All;
private string name;
+ ///
+ /// Gets the for the target file.
+ ///
+ ///
protected override FileInfo GetFileInfo()
{
var logsDir = new DirectoryInfo(Path.Combine("Logs",name));
@@ -22,12 +32,23 @@ namespace IPA.Logging.Printers
return finfo;
}
+ ///
+ /// Creates a new printer with the given name.
+ ///
+ /// the name of the logger
public PluginLogFilePrinter(string name)
{
this.name = name;
}
- public override void Print(IPA.Logging.Logger.Level level, DateTime time, string logName, string message)
+ ///
+ /// Prints an entry to the associated file.
+ ///
+ /// the of the message
+ /// the the message was recorded at
+ /// the name of the log that sent the message
+ /// the message to print
+ public override void Print(Logger.Level level, DateTime time, string logName, string message)
{
foreach (var line in message.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
fileWriter.WriteLine(string.Format("[{3} @ {2:HH:mm:ss}] {0}", line, logName, time, level.ToString().ToUpper()));
diff --git a/IPA.Loader/Logging/StandardLogger.cs b/IPA.Loader/Logging/StandardLogger.cs
index c1c821cd..cdcfcdae 100644
--- a/IPA.Loader/Logging/StandardLogger.cs
+++ b/IPA.Loader/Logging/StandardLogger.cs
@@ -8,12 +8,14 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using IPA;
-using LoggerBase = IPA.Logging.Logger;
using IPA.Logging.Printers;
namespace IPA.Logging
{
- public class StandardLogger : LoggerBase
+ ///
+ /// The default implimentation.
+ ///
+ public class StandardLogger : Logger
{
private static readonly IReadOnlyList defaultPrinters = new List()
{
@@ -47,6 +49,9 @@ namespace IPA.Logging
private string logName;
private static bool showSourceClass = true;
+ ///
+ /// All levels defined by this filter will be sent to loggers. All others will be ignored.
+ ///
public static LogLevel PrintFilter { get; set; } = LogLevel.InfoUp;
private List printers = new List(defaultPrinters);
@@ -70,6 +75,11 @@ namespace IPA.Logging
}
}
+ ///
+ /// Logs a specific message at a given level.
+ ///
+ /// the message level
+ /// the message to log
public override void Log(Level level, string message)
{
_logQueue.Add(new LogMessage
@@ -80,7 +90,11 @@ namespace IPA.Logging
time = DateTime.Now
});
}
-
+
+ ///
+ /// An override to which shows the method that called it.
+ ///
+ /// the message to log
public override void Debug(string message)
{ // add source to message
var stfm = new StackTrace().GetFrame(1).GetMethod();
@@ -144,7 +158,7 @@ namespace IPA.Logging
}
}
- public static void StopLogThread()
+ internal static void StopLogThread()
{
_logQueue.CompleteAdding();
_logThread.Join();
diff --git a/IPA.Loader/Updating/Backup/BackupUnit.cs b/IPA.Loader/Updating/Backup/BackupUnit.cs
index 0796d27e..c5e87d35 100644
--- a/IPA.Loader/Updating/Backup/BackupUnit.cs
+++ b/IPA.Loader/Updating/Backup/BackupUnit.cs
@@ -69,7 +69,7 @@ namespace IPA.Updating.Backup
///
/// Adds a file to the list of changed files and backups it.
///
- ///
+ ///
public void Add(FileInfo file)
{
var relativePath = LoneFunctions.GetRelativePath(Environment.CurrentDirectory, file.FullName);
diff --git a/IPA.Loader/Utilities/Extensions.cs b/IPA.Loader/Utilities/Extensions.cs
index 7a1c3399..55d8e01b 100644
--- a/IPA.Loader/Utilities/Extensions.cs
+++ b/IPA.Loader/Utilities/Extensions.cs
@@ -6,8 +6,16 @@ using System.Threading.Tasks;
namespace IPA.Utilities
{
+ ///
+ /// A class providing various extension methods.
+ ///
public static class Extensions
{
+ ///
+ /// Gets the default value for a given .
+ ///
+ /// the to get the default value for
+ /// the default value of
public static object GetDefault(this Type type)
{
if (type.IsValueType)
diff --git a/IPA.Loader/Utilities/LoneFunctions.cs b/IPA.Loader/Utilities/LoneFunctions.cs
index 1ed0b4db..15dc9263 100644
--- a/IPA.Loader/Utilities/LoneFunctions.cs
+++ b/IPA.Loader/Utilities/LoneFunctions.cs
@@ -7,8 +7,16 @@ using System.Threading.Tasks;
namespace IPA.Utilities
{
+ ///
+ /// A class providing static utility functions that in any other language would just *exist*.
+ ///
public static class LoneFunctions
{
+ ///
+ /// Converts a hex string to a byte array.
+ ///
+ /// the hex stream
+ /// the corresponding byte array
public static byte[] StringToByteArray(string hex)
{
int NumberChars = hex.Length;
@@ -18,6 +26,11 @@ namespace IPA.Utilities
return bytes;
}
+ ///
+ ///
+ ///
+ ///
+ ///
public static string ByteArrayToString(byte[] ba)
{
StringBuilder hex = new StringBuilder(ba.Length * 2);
@@ -30,6 +43,12 @@ namespace IPA.Utilities
// Distributed under the MIT/X11 software license
// Ref: http://www.opensource.org/licenses/mit-license.php.
// From: https://stackoverflow.com/a/8808245/3117125
+ ///
+ /// Uses unsafe code to compare 2 byte arrays quickly.
+ ///
+ /// array 1
+ /// array 2
+ /// whether or not they are byte-for-byte equal
public static unsafe bool UnsafeCompare(byte[] a1, byte[] a2)
{
if (a1 == a2) return true;
@@ -48,9 +67,15 @@ namespace IPA.Utilities
}
}
- public static string GetRelativePath(string filespec, string folder)
+ ///
+ /// Gets a path relative to the provided folder.
+ ///
+ /// the file to relativize
+ /// the source folder
+ /// a path to get from to
+ public static string GetRelativePath(string file, string folder)
{
- Uri pathUri = new Uri(filespec);
+ Uri pathUri = new Uri(file);
// Folders must end in a slash
if (!folder.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
diff --git a/IPA.Loader/Utilities/SteamCheck.cs b/IPA.Loader/Utilities/SteamCheck.cs
index 08bb004e..8f5f0dc8 100644
--- a/IPA.Loader/Utilities/SteamCheck.cs
+++ b/IPA.Loader/Utilities/SteamCheck.cs
@@ -6,11 +6,17 @@ using System.Threading.Tasks;
namespace IPA.Utilities
{
+ ///
+ /// Provides a utility to test if this is a Steam build of Beat Saber.
+ ///
public static class SteamCheck
{
- public static Type SteamVRCamera;
- public static Type SteamVRExternalCamera;
- public static Type SteamVRFade;
+ private static Type SteamVRCamera;
+ private static Type SteamVRExternalCamera;
+ private static Type SteamVRFade;
+ ///
+ /// Returns when called on a Steam installation.
+ ///
public static bool IsAvailable => FindSteamVRAsset();
private static bool FindSteamVRAsset()